From e4c2683e1da31bf30dbb6a56e9836cc2e4411042 Mon Sep 17 00:00:00 2001 From: titiger Date: Mon, 12 Jan 2015 01:46:12 +0100 Subject: [PATCH] fixed missing food for shared resource games on startup To claculate limitResourcesToStore() we need to first load all factions. Else we get wrong results for limitResourcesToStore(), and by this sometimes no food on startup, depending on the setup. --- source/glest_game/world/world.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 40f3b227..1ae088fa 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -2257,7 +2257,11 @@ void World::initUnits() { placeUnitAtLocation(map.getStartLocation(startLocationIndex), generationArea, unit, true); } } - + } + // the following is done here in an extra loop and not in the loop above, because shared resources games + // need to load all factions first, before calculating limitResourcesToStore() + for(int i = 0; i < getFactionCount(); ++i) { + Faction *f= factions[i]; // Ensure Starting Resource Amount are adjusted to max store levels f->limitResourcesToStore(); }