summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-23 18:54:51 +0000
committertruebrain <truebrain@openttd.org>2011-11-23 18:54:51 +0000
commitbd3fd1171ebc58751b06c9f93ec3ad38878786b8 (patch)
treecd190e968693d8d3f1b3a1a7ed42f367b03a7f01
parent31f266f25440ad402e225bf975b3fd9ccd68db8d (diff)
downloadopenttd-bd3fd1171ebc58751b06c9f93ec3ad38878786b8.tar.xz
(svn r23309) -Fix: loading old games didn't have goals set for towns (tnx to frosch for spotting)
-rw-r--r--src/saveload/afterload.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 97f35e6d4..5b86f4d0b 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2670,6 +2670,24 @@ bool AfterLoadGame()
/* The center of train vehicles was changed, fix up spacing. */
if (IsSavegameVersionBefore(164)) FixupTrainLengths();
+ if (IsSavegameVersionBefore(165)) {
+ Town *t;
+
+ FOR_ALL_TOWNS(t) {
+ /* Set the default cargo requirement for town growth */
+ switch (_settings_game.game_creation.landscape) {
+ case LT_ARCTIC:
+ if (FindFirstCargoWithTownEffect(TE_FOOD) != NULL) t->goal[TE_FOOD] = TOWN_GROWTH_WINTER;
+ break;
+
+ case LT_TROPIC:
+ if (FindFirstCargoWithTownEffect(TE_FOOD) != NULL) t->goal[TE_FOOD] = TOWN_GROWTH_DESERT;
+ if (FindFirstCargoWithTownEffect(TE_WATER) != NULL) t->goal[TE_WATER] = TOWN_GROWTH_DESERT;
+ break;
+ }
+ }
+ }
+
/* When any NewGRF has been changed the availability of some vehicles might
* have been changed too. e->company_avail must be set to 0 in that case
* which is done by StartupEngines(). */