diff options
author | smatz <smatz@openttd.org> | 2008-11-18 22:43:59 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-11-18 22:43:59 +0000 |
commit | 07e3c096b3b744ef1d094c9481faa31ec8d2034a (patch) | |
tree | fb5982346d711d936b8aa9f87eab53f416ab29d4 /src/town_gui.cpp | |
parent | e1a36e90a44cf50ebcfa52ec8685e76230a22910 (diff) | |
download | openttd-07e3c096b3b744ef1d094c9481faa31ec8d2034a.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.cpp | 7 |
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; |