summaryrefslogtreecommitdiff
path: root/src/town_gui.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-11-18 22:43:59 +0000
committersmatz <smatz@openttd.org>2008-11-18 22:43:59 +0000
commit698f05e756bbcd1aad453d5e25c5e7949a1a1a74 (patch)
treefb5982346d711d936b8aa9f87eab53f416ab29d4 /src/town_gui.cpp
parent6386deb70888367f1d74ab432cbcb384f17f959f (diff)
downloadopenttd-698f05e756bbcd1aad453d5e25c5e7949a1a1a74.tar.xz
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
-Codechange: rewrite parts of code responsible for caching index of nearest town
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r--src/town_gui.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 48f8524b1..3ebe75286 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -725,14 +725,15 @@ public:
this->HandleButtonClick(TSEW_RANDOMTOWN);
_generating_world = true;
+ UpdateNearestTownForRoadTiles(true);
t = CreateRandomTown(20, mode, size);
+ UpdateNearestTownForRoadTiles(false);
_generating_world = false;
if (t == NULL) {
ShowErrorMessage(STR_NO_SPACE_FOR_TOWN, STR_CANNOT_GENERATE_TOWN, 0, 0);
} else {
ScrollMainWindowToTile(t->xy);
- InvalidateTownForRoadTile();
}
} break;
@@ -740,11 +741,11 @@ public:
this->HandleButtonClick(TSEW_MANYRANDOMTOWNS);
_generating_world = true;
+ UpdateNearestTownForRoadTiles(true);
if (!GenerateTowns()) {
ShowErrorMessage(STR_NO_SPACE_FOR_TOWN, STR_CANNOT_GENERATE_TOWN, 0, 0);
- } else {
- InvalidateTownForRoadTile();
}
+ UpdateNearestTownForRoadTiles(false);
_generating_world = false;
break;