← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~abacabadabacaba/widelands/bug1749586 into lp:widelands

 

Evgeny Kapun has proposed merging lp:~abacabadabacaba/widelands/bug1749586 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1749586 in widelands: "Fish breeder can't breed fish if the game is loaded after all fish is caught"
  https://bugs.launchpad.net/widelands/+bug/1749586

For more details, see:
https://code.launchpad.net/~abacabadabacaba/widelands/bug1749586/+merge/337912

Fix for bug #1749586
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~abacabadabacaba/widelands/bug1749586 into lp:widelands.
=== modified file 'src/map_io/map_resources_packet.cc'
--- src/map_io/map_resources_packet.cc	2017-08-19 22:22:20 +0000
+++ src/map_io/map_resources_packet.cc	2018-02-17 13:52:34 +0000
@@ -66,28 +66,11 @@
 			for (uint16_t y = 0; y < map->get_height(); ++y) {
 				for (uint16_t x = 0; x < map->get_width(); ++x) {
 					DescriptionIndex const id = fr.unsigned_8();
-					ResourceAmount const found_amount = fr.unsigned_8();
-					ResourceAmount const amount = found_amount;
+					ResourceAmount const amount = fr.unsigned_8();
 					ResourceAmount const start_amount = fr.unsigned_8();
-
-					DescriptionIndex set_id;
-					ResourceAmount set_amount, set_start_amount;
-					//  if amount is zero, theres nothing here
-					if (!amount) {
-						set_id = 0;
-						set_amount = 0;
-						set_start_amount = 0;
-					} else {
-						set_id = smap[id];
-						set_amount = amount;
-						set_start_amount = start_amount;
-					}
-
-					if (0xa < set_id)
-						throw "Unknown resource in map file. It is not in world!\n";
 					const auto fcoords = map->get_fcoords(Coords(x, y));
-					map->initialize_resources(fcoords, set_id, set_start_amount);
-					map->set_resources(fcoords, set_amount);
+					map->initialize_resources(fcoords, smap[id], start_amount);
+					map->set_resources(fcoords, amount);
 				}
 			}
 		} else {