widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02571
[Merge] lp:~hjd/widelands/simplify-loop into lp:widelands
Hans Joachim Desserud has proposed merging lp:~hjd/widelands/simplify-loop into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1350476 in widelands: "Assigned value is never read in game_io /game_player_economies_data_packet.cc (and general strangeness)"
https://bugs.launchpad.net/widelands/+bug/1350476
For more details, see:
https://code.launchpad.net/~hjd/widelands/simplify-loop/+merge/229320
Basically implementing the solution suggested in the bug report, plus trim out a couple more intermediary variables.
--
https://code.launchpad.net/~hjd/widelands/simplify-loop/+merge/229320
Your team Widelands Developers is requested to review the proposed merge of lp:~hjd/widelands/simplify-loop into lp:widelands.
=== modified file 'src/game_io/game_player_economies_data_packet.cc'
--- src/game_io/game_player_economies_data_packet.cc 2014-07-28 14:17:07 +0000
+++ src/game_io/game_player_economies_data_packet.cc 2014-08-02 11:17:59 +0000
@@ -50,13 +50,10 @@
iterate_players_existing(p, nr_players, game, player)
try {
Player::Economies & economies = player->m_economies;
- uint16_t const nr_economies = economies.size();
- Player::Economies ecos(nr_economies);
- for (Economy * temp_eco : ecos) {
+ for (uint32_t i = 0; i < economies.size(); ++i) {
uint32_t value = fr.Unsigned32();
if (value < 0xffffffff) {
if (upcast(Flag const, flag, map[value].get_immovable())) {
- temp_eco = flag->get_economy();
EconomyDataPacket d(flag->get_economy());
d.Read(fr);
} else {