From 698f05e756bbcd1aad453d5e25c5e7949a1a1a74 Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 18 Nov 2008 22:43:59 +0000 Subject: (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 --- src/town_gui.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/town_gui.cpp') 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; -- cgit v1.2.3-54-g00ecf