summaryrefslogtreecommitdiff
path: root/src/town_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r--src/town_gui.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index ec44b246b..a4bb24063 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -27,6 +27,7 @@
#include "querystring_gui.h"
#include "window_func.h"
#include "townname_func.h"
+#include "core/backup_type.hpp"
#include "core/geometry_func.hpp"
#include "genworld.h"
#include "stringfilter_type.h"
@@ -1184,15 +1185,16 @@ public:
this->SetFocusedWidget(WID_TF_TOWN_NAME_EDITBOX);
break;
- case WID_TF_MANY_RANDOM_TOWNS:
- _generating_world = true;
+ case WID_TF_MANY_RANDOM_TOWNS: {
+ Backup<bool> old_generating_world(_generating_world, true, FILE_LINE);
UpdateNearestTownForRoadTiles(true);
if (!GenerateTowns(this->town_layout)) {
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, WL_INFO);
}
UpdateNearestTownForRoadTiles(false);
- _generating_world = false;
+ old_generating_world.Restore();
break;
+ }
case WID_TF_SIZE_SMALL: case WID_TF_SIZE_MEDIUM: case WID_TF_SIZE_LARGE: case WID_TF_SIZE_RANDOM:
this->town_size = (TownSize)(widget - WID_TF_SIZE_SMALL);