Assigned value is never read in game_io /game_player_economies_data_packet.cc (and general strangeness)
Bug #1350476 reported by
Hans Joachim Desserud
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Low
|
Hans Joachim Desserud |
Bug Description
I ran scan-build on r7157 and it found two issue in this file. At first I thought they were simply variations over a common issue, but it turns out that's not the case. Furthermore, it just seems strange.
In line 55, we loop through all the economies via a foreach, which is fair enough. Though, in some cases we reassign the value of the looping variable (line 59). I'm not really sure whether it should actually be reassigned or treated as a separate value. Though in either case, the value of the variable is never read anywhere so it's pretty harmless. Though still rather strange. Could someone please take a look at this?
Related branches
lp:~hjd/widelands/simplify-loop
- SirVer: Approve
-
Diff: 18 lines (+1/-4)1 file modifiedsrc/game_io/game_player_economies_data_packet.cc (+1/-4)
Changed in widelands: | |
status: | In Progress → Fix Committed |
Changed in widelands: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
That should just be for (int i = 0; i < nr_economies; ++i).
Basically the write code iterates through all economy and for each one searches a map object that is part of this economy. The objects id is then written to the file. On load, the map object is found and it's economy loads the data that was saved. Rather convoluted, but necessary as we can not guarantee that economies are created in the same order as in the original game on load.