Codechange: Don't explicitly unset _generating_world outside of genworld.cpp (#9418)

This commit is contained in:
Loïc Guilloux
2021-07-10 14:59:17 +02:00
committed by GitHub
parent 85faa218ff
commit ddb6024bc6
4 changed files with 18 additions and 14 deletions

View File

@@ -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);