summaryrefslogtreecommitdiff
path: root/src/fios_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fios_gui.cpp')
-rw-r--r--src/fios_gui.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 40a082d64..c04092f6b 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -398,12 +398,13 @@ public:
}
}
- virtual ~SaveLoadWindow()
+ void Close() override
{
/* pause is only used in single-player, non-editor mode, non menu mode */
if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) {
DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE);
}
+ this->Window::Close();
}
void DrawWidget(const Rect &r, int widget) const override
@@ -617,12 +618,12 @@ public:
_file_to_saveload.SetTitle(this->selected->title);
if (this->abstract_filetype == FT_HEIGHTMAP) {
- delete this;
+ this->Close();
ShowHeightmapLoad();
} else if (!_load_check_data.HasNewGrfs() || _load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()) {
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
ClearErrorMessages();
- delete this;
+ this->Close();
}
break;
}
@@ -688,7 +689,7 @@ public:
_file_to_saveload.SetName(name);
_file_to_saveload.SetTitle(file->title);
- delete this;
+ this->Close();
ShowHeightmapLoad();
}
}
@@ -749,7 +750,7 @@ public:
EventState OnKeyPress(WChar key, uint16 keycode) override
{
if (keycode == WKC_ESC) {
- delete this;
+ this->Close();
return ES_HANDLED;
}