diff options
author | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-07-10 14:59:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-10 14:59:17 +0200 |
commit | ddb6024bc69c63e3dafec61b3f642eedc57555cc (patch) | |
tree | a10cdfd3bd372f8b86636392013fef4bb1739f18 /src/town_gui.cpp | |
parent | 85faa218ffe3cc8eab9c8822a9f5a5117937d8b6 (diff) | |
download | openttd-ddb6024bc69c63e3dafec61b3f642eedc57555cc.tar.xz |
Codechange: Don't explicitly unset _generating_world outside of genworld.cpp (#9418)
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r-- | src/town_gui.cpp | 8 |
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); |