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/terraform_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/terraform_gui.cpp')
-rw-r--r-- | src/terraform_gui.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 6094c710f..f710cecc5 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -8,6 +8,7 @@ /** @file terraform_gui.cpp GUI related to terraforming the map. */ #include "stdafx.h" +#include "core/backup_type.hpp" #include "clear_map.h" #include "company_func.h" #include "company_base.h" @@ -54,7 +55,7 @@ static void GenerateDesertArea(TileIndex end, TileIndex start) { if (_game_mode != GM_EDITOR) return; - _generating_world = true; + Backup<bool> old_generating_world(_generating_world, true, FILE_LINE); TileArea ta(start, end); for (TileIndex tile : ta) { @@ -62,7 +63,7 @@ static void GenerateDesertArea(TileIndex end, TileIndex start) DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR); MarkTileDirtyByTile(tile); } - _generating_world = false; + old_generating_world.Restore(); InvalidateWindowClassesData(WC_TOWN_VIEW, 0); } @@ -497,7 +498,7 @@ static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed) if (confirmed) { /* Set generating_world to true to get instant-green grass after removing * company property. */ - _generating_world = true; + Backup<bool> old_generating_world(_generating_world, true, FILE_LINE); /* Delete all companies */ for (Company *c : Company::Iterate()) { @@ -505,7 +506,7 @@ static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed) delete c; } - _generating_world = false; + old_generating_world.Restore(); /* Delete all station signs */ for (BaseStation *st : BaseStation::Iterate()) { |