diff options
author | glx22 <glx@openttd.org> | 2021-05-17 15:46:38 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-05-29 21:08:25 +0200 |
commit | 5799402f7a4872d03809838dd7fa01db42bbd282 (patch) | |
tree | 6b54e235c14621035b4ec7923edb93980be5f056 | |
parent | 994bf19aef3dde6c9482434bdc51688f76a937ea (diff) | |
download | openttd-5799402f7a4872d03809838dd7fa01db42bbd282.tar.xz |
Codechange: Rename window related DeleteXXX to match new behaviour
63 files changed, 253 insertions, 253 deletions
diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index 95c971af8..d48ce05bf 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -114,7 +114,7 @@ cur_company.Restore(); InvalidateWindowData(WC_AI_DEBUG, 0, -1); - DeleteWindowById(WC_AI_SETTINGS, company); + CloseWindowById(WC_AI_SETTINGS, company); } /* static */ void AI::Pause(CompanyID company) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 1817148f4..c7ae4740e 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -182,7 +182,7 @@ struct AIListWindow : public Window { } InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI); InvalidateWindowClassesData(WC_AI_SETTINGS); - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); InvalidateWindowClassesData(WC_TEXTFILE); } @@ -276,7 +276,7 @@ static WindowDesc _ai_list_desc( */ static void ShowAIListWindow(CompanyID slot) { - DeleteWindowByClass(WC_AI_LIST); + CloseWindowByClass(WC_AI_LIST); new AIListWindow(&_ai_list_desc, slot); } @@ -444,7 +444,7 @@ struct AISettingsWindow : public Window { if (!this->IsEditableItem(config_item)) return; if (this->clicked_row != num) { - DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); HideDropDownMenu(this); this->clicked_row = num; this->clicked_dropdown = false; @@ -584,7 +584,7 @@ struct AISettingsWindow : public Window { { this->RebuildVisibleSettings(); HideDropDownMenu(this); - DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); } private: @@ -628,8 +628,8 @@ static WindowDesc _ai_settings_desc( */ static void ShowAISettingsWindow(CompanyID slot) { - DeleteWindowByClass(WC_AI_LIST); - DeleteWindowByClass(WC_AI_SETTINGS); + CloseWindowByClass(WC_AI_LIST); + CloseWindowByClass(WC_AI_SETTINGS); new AISettingsWindow(&_ai_settings_desc, slot); } @@ -669,7 +669,7 @@ struct ScriptTextfileWindow : public TextfileWindow { */ void ShowScriptTextfileWindow(TextfileType file_type, CompanyID slot) { - DeleteWindowById(WC_TEXTFILE, file_type); + CloseWindowById(WC_TEXTFILE, file_type); new ScriptTextfileWindow(file_type, slot); } @@ -746,8 +746,8 @@ struct AIConfigWindow : public Window { void Close() override { - DeleteWindowByClass(WC_AI_LIST); - DeleteWindowByClass(WC_AI_SETTINGS); + CloseWindowByClass(WC_AI_LIST); + CloseWindowByClass(WC_AI_SETTINGS); this->Window::Close(); } @@ -972,7 +972,7 @@ struct AIConfigWindow : public Window { /** Open the AI config window. */ void ShowAIConfigWindow() { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new AIConfigWindow(); } @@ -1264,7 +1264,7 @@ struct AIDebugWindow : public Window { this->highlight_row = -1; // The highlight of one AI make little sense for another AI. /* Close AI settings window to prevent confusion */ - DeleteWindowByClass(WC_AI_SETTINGS); + CloseWindowByClass(WC_AI_SETTINGS); this->InvalidateData(-1); diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 1941a8602..cfe0ca4cb 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -79,7 +79,7 @@ struct BuildAirToolbarWindow : Window { void Close() override { if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); + if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false); this->Window::Close(); } @@ -97,7 +97,7 @@ struct BuildAirToolbarWindow : Window { WID_AT_AIRPORT, WIDGET_LIST_END); if (!can_build) { - DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR); + CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR); /* Show in the tooltip why this button is disabled. */ this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); @@ -159,8 +159,8 @@ struct BuildAirToolbarWindow : Window { this->RaiseButtons(); - DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR); + CloseWindowById(WC_SELECT_STATION, 0); } static HotkeyList hotkeys; @@ -218,7 +218,7 @@ Window *ShowBuildAirToolbar() { if (!Company::IsValidID(_local_company)) return nullptr; - DeleteWindowByClass(WC_BUILD_TOOLBAR); + CloseWindowByClass(WC_BUILD_TOOLBAR); return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR); } @@ -279,7 +279,7 @@ public: void Close() override { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); this->PickerWindowBase::Close(); } diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index a4d7bcb7d..a7bd071db 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -864,7 +864,7 @@ static WindowDesc _replace_vehicle_desc( */ void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype) { - DeleteWindowById(WC_REPLACE_VEHICLE, vehicletype); + CloseWindowById(WC_REPLACE_VEHICLE, vehicletype); WindowDesc *desc; switch (vehicletype) { case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 4a9a56b79..74c7234d5 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -360,7 +360,7 @@ static WindowDesc _build_bridge_desc( */ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type) { - DeleteWindowByClass(WC_BUILD_BRIDGE); + CloseWindowByClass(WC_BUILD_BRIDGE); /* Data type for the bridge. * Bit 16,15 = transport type, diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index fb22e7380..bdd32dc22 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1686,7 +1686,7 @@ void ShowBuildVehicleWindow(TileIndex tile, VehicleType type) assert(IsCompanyBuildableVehicleType(type)); - DeleteWindowById(WC_BUILD_VEHICLE, num); + CloseWindowById(WC_BUILD_VEHICLE, num); new BuildVehicleWindow(&_build_vehicle_desc, tile, type); } diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 497276ad6..4821edbcc 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -415,6 +415,6 @@ static WindowDesc _cheats_desc( /** Open cheat window. */ void ShowCheatWindow() { - DeleteWindowById(WC_CHEATS, 0); + CloseWindowById(WC_CHEATS, 0); new CheatWindow(&_cheats_desc); } diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index f00db97c5..e58d29b2b 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -76,7 +76,7 @@ Company::~Company() { if (CleaningPool()) return; - DeleteCompanyWindows(this->index); + CloseCompanyWindows(this->index); } /** @@ -115,7 +115,7 @@ void SetLocalCompany(CompanyID new_company) _current_company = _local_company = new_company; /* Delete any construction windows... */ - if (switching_company) DeleteConstructionWindows(); + if (switching_company) CloseConstructionWindows(); /* ... and redraw the whole screen. */ MarkWholeScreenDirty(); @@ -824,7 +824,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id); /* Delete multiplayer progress bar */ - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); Company *c = DoStartupNewCompany(false); @@ -887,7 +887,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 if (!(flags & DC_EXEC)) return CommandCost(); /* Delete any open window of the company */ - DeleteCompanyWindows(c->index); + CloseCompanyWindows(c->index); CompanyNewsInformation *cni = MallocT<CompanyNewsInformation>(1); cni->FillData(c); diff --git a/src/company_gui.h b/src/company_gui.h index d5c69f696..f6149b05f 100644 --- a/src/company_gui.h +++ b/src/company_gui.h @@ -23,7 +23,7 @@ void ShowCompanyFinances(CompanyID company); void ShowCompany(CompanyID company); void InvalidateCompanyWindows(const Company *c); -void DeleteCompanyWindows(CompanyID company); +void CloseCompanyWindows(CompanyID company); void DirtyCompanyInfrastructureWindows(CompanyID company); #endif /* COMPANY_GUI_H */ diff --git a/src/console_gui.cpp b/src/console_gui.cpp index e5d80fcba..b9062088e 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -443,7 +443,7 @@ void IConsoleSwitch() break; case ICONSOLE_OPENED: case ICONSOLE_FULL: - DeleteWindowById(WC_CONSOLE, 0); + CloseWindowById(WC_CONSOLE, 0); break; } diff --git a/src/date_gui.cpp b/src/date_gui.cpp index 77b9a7c4c..932728720 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -212,6 +212,6 @@ static WindowDesc _set_date_desc( */ void ShowSetDateWindow(Window *parent, int window_number, Date initial_date, Year min_year, Year max_year, SetDateCallback *callback) { - DeleteWindowByClass(WC_SET_DATE); + CloseWindowByClass(WC_SET_DATE); new SetDateWindow(&_set_date_desc, window_number, parent, initial_date, min_year, max_year, callback); } diff --git a/src/depot.cpp b/src/depot.cpp index 05e2af3d4..13317e8a3 100644 --- a/src/depot.cpp +++ b/src/depot.cpp @@ -41,9 +41,9 @@ Depot::~Depot() RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index); /* Delete the depot-window */ - DeleteWindowById(WC_VEHICLE_DEPOT, this->xy); + CloseWindowById(WC_VEHICLE_DEPOT, this->xy); /* Delete the depot list */ VehicleType vt = GetDepotVehicleType(this->xy); - DeleteWindowById(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_DEPOT_LIST, vt, GetTileOwner(this->xy), this->index).Pack()); + CloseWindowById(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_DEPOT_LIST, vt, GetTileOwner(this->xy), this->index).Pack()); } diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 80774e900..151eb928d 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -293,8 +293,8 @@ struct DepotWindow : Window { void Close() override { - DeleteWindowById(WC_BUILD_VEHICLE, this->window_number); - DeleteWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false); + CloseWindowById(WC_BUILD_VEHICLE, this->window_number); + CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false); OrderBackup::Reset(this->window_number); this->Window::Close(); } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 483a71d6b..77ebe1be7 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -104,7 +104,7 @@ struct BuildDocksToolbarWindow : Window { void Close() override { if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); + if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false); this->Window::Close(); } @@ -124,8 +124,8 @@ struct BuildDocksToolbarWindow : Window { WID_DT_BUOY, WIDGET_LIST_END); if (!can_build) { - DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER); - DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); + CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER); + CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); } if (_game_mode != GM_EDITOR) { @@ -262,10 +262,10 @@ struct BuildDocksToolbarWindow : Window { this->RaiseButtons(); - DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER); - DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); - DeleteWindowById(WC_SELECT_STATION, 0); - DeleteWindowByClass(WC_BUILD_BRIDGE); + CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER); + CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); + CloseWindowById(WC_SELECT_STATION, 0); + CloseWindowByClass(WC_BUILD_BRIDGE); } void OnPlacePresize(Point pt, TileIndex tile_from) override @@ -359,7 +359,7 @@ Window *ShowBuildDocksToolbar() { if (!Company::IsValidID(_local_company)) return nullptr; - DeleteWindowByClass(WC_BUILD_TOOLBAR); + CloseWindowByClass(WC_BUILD_TOOLBAR); return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER); } @@ -419,7 +419,7 @@ public: void Close() override { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); this->PickerWindowBase::Close(); } diff --git a/src/economy.cpp b/src/economy.cpp index 16a607228..efea96806 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1997,7 +1997,7 @@ static void DoAcquireCompany(Company *c) if (c->is_ai) AI::Stop(c->index); - DeleteCompanyWindows(ci); + CloseCompanyWindows(ci); InvalidateWindowClassesData(WC_TRAINS_LIST, 0); InvalidateWindowClassesData(WC_SHIPS_LIST, 0); InvalidateWindowClassesData(WC_ROADVEH_LIST, 0); diff --git a/src/engine.cpp b/src/engine.cpp index 5e002a3c2..114cc1db6 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -528,7 +528,7 @@ bool EngineOverrideManager::ResetToCurrentNewGRFConfig() */ void SetupEngines() { - DeleteWindowByClass(WC_ENGINE_PREVIEW); + CloseWindowByClass(WC_ENGINE_PREVIEW); _engine_pool.CleanPool(); assert(_engine_mngr.size() >= _engine_mngr.NUM_DEFAULT_ENGINES); @@ -837,7 +837,7 @@ void EnginesDailyLoop() if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) { if (e->preview_company != INVALID_COMPANY) { if (!--e->preview_wait) { - DeleteWindowById(WC_ENGINE_PREVIEW, i); + CloseWindowById(WC_ENGINE_PREVIEW, i); e->preview_company = INVALID_COMPANY; } } else if (CountBits(e->preview_asked) < MAX_COMPANIES) { @@ -1015,7 +1015,7 @@ static void NewVehicleAvailable(Engine *e) if (e->type == VEH_AIRCRAFT) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_AIR); /* Close pending preview windows */ - DeleteWindowById(WC_ENGINE_PREVIEW, index); + CloseWindowById(WC_ENGINE_PREVIEW, index); } /** Monthly update of the availability, reliability, and preview offers of the engines. */ diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index c04092f6b..2d33875f6 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -920,7 +920,7 @@ static WindowDesc _save_dialog_desc( */ void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop) { - DeleteWindowById(WC_SAVELOAD, 0); + CloseWindowById(WC_SAVELOAD, 0); WindowDesc *sld; if (fop == SLO_SAVE) { diff --git a/src/genworld.cpp b/src/genworld.cpp index dc722ac00..5ed83d5aa 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -76,7 +76,7 @@ static void CleanupGeneration() _gw.proc = nullptr; _gw.abortp = nullptr; - DeleteWindowByClass(WC_MODAL_PROGRESS); + CloseWindowByClass(WC_MODAL_PROGRESS); ShowFirstError(); MarkWholeScreenDirty(); } @@ -314,7 +314,7 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0); UnshowCriticalError(); - DeleteAllNonVitalWindows(); + CloseAllNonVitalWindows(); HideVitalWindows(); ShowGenerateWorldProgress(); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 69ae9576a..ab5a781ef 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -285,7 +285,7 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = { static void StartGeneratingLandscape(GenerateLandscapeWindowMode mode) { - DeleteAllNonVitalWindows(); + CloseAllNonVitalWindows(); ClearErrorMessages(); /* Copy all XXX_newgame to XXX when coming from outside the editor */ @@ -974,7 +974,7 @@ static void _ShowGenerateLandscape(GenerateLandscapeWindowMode mode) uint x = 0; uint y = 0; - DeleteWindowByClass(WC_GENERATE_LANDSCAPE); + CloseWindowByClass(WC_GENERATE_LANDSCAPE); /* Generate a new seed when opening the window */ _settings_newgame.game_creation.generation_seed = InteractiveRandom(); @@ -1267,7 +1267,7 @@ static WindowDesc _create_scenario_desc( /** Show the window to create a scenario. */ void ShowCreateScenario() { - DeleteWindowByClass(WC_GENERATE_LANDSCAPE); + CloseWindowByClass(WC_GENERATE_LANDSCAPE); new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO); } diff --git a/src/goal.cpp b/src/goal.cpp index fe36f286e..c61165059 100644 --- a/src/goal.cpp +++ b/src/goal.cpp @@ -296,13 +296,13 @@ CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1 if (_current_company == OWNER_DEITY) { /* It has been requested to close this specific question on all clients */ - if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1); + if (flags & DC_EXEC) CloseWindowById(WC_GOAL_QUESTION, p1); return CommandCost(); } if (_networking && _local_company == _current_company) { /* Somebody in the same company answered the question. Close the window */ - if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1); + if (flags & DC_EXEC) CloseWindowById(WC_GOAL_QUESTION, p1); if (!_network_server) return CommandCost(); } diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp index bee5b03f2..50b361d00 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -382,7 +382,7 @@ CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 VehicleType vt = g->vehicle_type; /* Delete the Replace Vehicle Windows */ - DeleteWindowById(WC_REPLACE_VEHICLE, g->vehicle_type); + CloseWindowById(WC_REPLACE_VEHICLE, g->vehicle_type); delete g; InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).Pack()); diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 1a6deae2c..89a89983d 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -449,7 +449,7 @@ public: /* Process ID-invalidation in command-scope as well */ if (this->group_rename != INVALID_GROUP && !Group::IsValidID(this->group_rename)) { - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); this->group_rename = INVALID_GROUP; } diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp index e36935c1e..768b9c9c1 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -232,7 +232,7 @@ static WindowDesc _endgame_desc( */ void ShowHighscoreTable(int difficulty, int8 ranking) { - DeleteWindowByClass(WC_HIGHSCORE); + CloseWindowByClass(WC_HIGHSCORE); new HighScoreWindow(&_highscore_desc, difficulty, ranking); } @@ -246,6 +246,6 @@ void ShowEndGameChart() if (_network_dedicated || (!_networking && !Company::IsValidID(_local_company))) return; HideVitalWindows(); - DeleteWindowByClass(WC_ENDSCREEN); + CloseWindowByClass(WC_ENDSCREEN); new EndGameWindow(&_endgame_desc); } diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index c6ae129c3..d88f7b692 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -190,7 +190,7 @@ Industry::~Industry() DecIndustryTypeCount(this->type); DeleteIndustryNews(this->index); - DeleteWindowById(WC_INDUSTRY_VIEW, this->index); + CloseWindowById(WC_INDUSTRY_VIEW, this->index); DeleteNewGRFInspectWindow(GSF_INDUSTRIES, this->index); DeleteSubsidyWith(ST_INDUSTRY, this->index); diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 1e8cfcbfa..559040f37 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -303,8 +303,8 @@ struct MainWindow : Window } case GHK_RESET_OBJECT_TO_PLACE: ResetObjectToPlace(); break; - case GHK_DELETE_WINDOWS: DeleteNonVitalWindows(); break; - case GHK_DELETE_NONVITAL_WINDOWS: DeleteAllNonVitalWindows(); break; + case GHK_DELETE_WINDOWS: CloseNonVitalWindows(); break; + case GHK_DELETE_NONVITAL_WINDOWS: CloseAllNonVitalWindows(); break; case GHK_DELETE_ALL_MESSAGES: DeleteAllMessages(); break; case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 59b0282d5..6ba65c703 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -399,7 +399,7 @@ public: */ void ShowLandInfo(TileIndex tile) { - DeleteWindowById(WC_LAND_INFO, 0); + CloseWindowById(WC_LAND_INFO, 0); new LandInfoWindow(tile); } @@ -564,7 +564,7 @@ struct AboutWindow : public Window { void ShowAboutWindow() { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new AboutWindow(); } @@ -789,7 +789,7 @@ struct TooltipsWindow : public Window */ void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip) { - DeleteWindowById(WC_TOOLTIPS, 0); + CloseWindowById(WC_TOOLTIPS, 0); if (str == STR_NULL || !_cursor.in_window) return; @@ -1142,7 +1142,7 @@ void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *paren { assert(parent != nullptr); - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags); } @@ -1219,7 +1219,7 @@ struct QueryWindow : public Window { switch (widget) { case WID_Q_YES: { /* in the Generate New World window, clicking 'Yes' causes - * DeleteNonVitalWindows() to be called - we shouldn't be in a window then */ + * CloseNonVitalWindows() to be called - we shouldn't be in a window then */ QueryCallbackProc *proc = this->proc; Window *parent = this->parent; /* Prevent the destructor calling the callback function */ diff --git a/src/network/network.cpp b/src/network/network.cpp index 2bc358944..d89789cf9 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -668,7 +668,7 @@ public: void OnFailure() override { - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY); ShowErrorMessage(STR_NETWORK_ERROR_NOCONNECTION, INVALID_STRING_ID, WL_ERROR); } @@ -988,7 +988,7 @@ void NetworkDisconnect(bool blocking, bool close_admins) if (_settings_client.network.server_advertise) NetworkUDPRemoveAdvertise(blocking); - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); NetworkClose(close_admins); diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 53546aa87..b42f0c562 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -533,6 +533,6 @@ static WindowDesc _chat_window_desc( */ void ShowNetworkChatQueryWindow(DestType type, int dest) { - DeleteWindowByClass(WC_SEND_NETWORK_MSG); + CloseWindowByClass(WC_SEND_NETWORK_MSG); new NetworkChatWindow(&_chat_window_desc, type, dest); } diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 44359941a..161bbf412 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -204,7 +204,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res) this->CloseConnection(res); _networking = false; - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); return; } @@ -560,7 +560,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p) { /* We try to join a server which is full */ ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL); - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); return NETWORK_RECV_STATUS_SERVER_FULL; } @@ -569,7 +569,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet * { /* We try to join a server where we are banned */ ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL); - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); return NETWORK_RECV_STATUS_SERVER_BANNED; } @@ -754,7 +754,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *p /* Perform an emergency save if we had already entered the game */ if (this->status == STATUS_ACTIVE) ClientNetworkEmergencySave(); - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); return NETWORK_RECV_STATUS_SERVER_ERROR; } @@ -924,7 +924,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet this->last_packet = std::chrono::steady_clock::now(); if (!load_success) { - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); ShowErrorMessage(STR_NETWORK_ERROR_SAVEGAMEERROR, INVALID_STRING_ID, WL_CRITICAL); return NETWORK_RECV_STATUS_SAVEGAME; } diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index e09b05ec7..f78a839b8 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -495,7 +495,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *p) /* We have a file opened, thus are downloading internal content */ size_t toRead = p->RemainingBytesToTransfer(); if (toRead != 0 && (size_t)p->TransferOut(TransferOutFWrite, this->curFile) != toRead) { - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD); ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR); this->CloseConnection(); fclose(this->curFile); @@ -529,7 +529,7 @@ bool ClientNetworkContentSocketHandler::BeforeDownload() std::string filename = GetFullFilename(this->curInfo, true); if (filename.empty() || (this->curFile = fopen(filename.c_str(), "wb")) == nullptr) { /* Unless that fails of course... */ - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD); ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR); return false; } diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 8c75cb572..a74d902a3 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -74,7 +74,7 @@ struct ContentTextfileWindow : public TextfileWindow { void ShowContentTextfileWindow(TextfileType file_type, const ContentInfo *ci) { - DeleteWindowById(WC_TEXTFILE, file_type); + CloseWindowById(WC_TEXTFILE, file_type); new ContentTextfileWindow(file_type, ci); } @@ -267,7 +267,7 @@ public: } else { /* If downloading succeeded, close the online content window. This will close * the current window as well. */ - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST); } } } @@ -1130,7 +1130,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentT _network_content_client.RequestContentList(cv, true); } - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST); new NetworkContentListWindow(&_network_content_list_desc, cv != nullptr, types); #else ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 7f179a05f..bd91cc25a 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -677,7 +677,7 @@ public: { switch (widget) { case WID_NG_CANCEL: // Cancel button - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); break; case WID_NG_NAME: // Sort by name @@ -966,8 +966,8 @@ static WindowDesc _network_game_window_desc( void ShowNetworkGameWindow() { static bool first = true; - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY); - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START); /* Only show once */ if (first) { @@ -1265,8 +1265,8 @@ static void ShowNetworkStartServerWindow() { if (!NetworkValidateClientName()) return; - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY); new NetworkStartServerWindow(&_network_start_server_window_desc); } @@ -1559,8 +1559,8 @@ static void ShowNetworkLobbyWindow(NetworkGameList *ngl) { if (!NetworkValidateClientName()) return; - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START); - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); _settings_client.network.last_joined = ngl->connection_string; @@ -2519,7 +2519,7 @@ static WindowDesc _network_join_status_window_desc( void ShowJoinStatusWindow() { - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); new NetworkJoinStatusWindow(&_network_join_status_window_desc); } @@ -2642,7 +2642,7 @@ static WindowDesc _network_company_password_window_desc( void ShowNetworkCompanyPasswordWindow(Window *parent) { - DeleteWindowById(WC_COMPANY_PASSWORD_WINDOW, 0); + CloseWindowById(WC_COMPANY_PASSWORD_WINDOW, 0); new NetworkCompanyPasswordWindow(&_network_company_password_window_desc, parent); } diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 044d36193..4e37be54f 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -706,7 +706,7 @@ void DoScanNewGRFFiles(NewGRFScanCallback *callback) InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE, GOID_NEWGRF_RESCANNED, true); if (!_exit_game && callback != nullptr) callback->OnNewGRFsScanned(); - DeleteWindowByClass(WC_MODAL_PROGRESS); + CloseWindowByClass(WC_MODAL_PROGRESS); SetModalProgress(false); MarkWholeScreenDirty(); } diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 0d9fae8a4..9453f5de9 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -736,7 +736,7 @@ void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index) if (feature == GSF_INVALID) return; WindowNumber wno = GetInspectWindowNumber(feature, index); - DeleteWindowById(WC_NEWGRF_INSPECT, wno); + CloseWindowById(WC_NEWGRF_INSPECT, wno); /* Reinitialise the land information window to remove the "debug" sprite if needed. * Note: Since we might be called from a command here, it is important to not execute diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index a9b43ea9d..f017cbf7f 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -341,7 +341,7 @@ struct NewGRFParametersWindow : public Window { uint num = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NP_BACKGROUND); if (num >= this->vscroll->GetCount()) break; if (this->clicked_row != num) { - DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); HideDropDownMenu(this); this->clicked_row = num; this->clicked_dropdown = false; @@ -481,7 +481,7 @@ struct NewGRFParametersWindow : public Window { this->vscroll->SetCount(this->action14present ? this->grf_config->num_valid_params : this->grf_config->num_params); if (this->clicked_row != UINT_MAX && this->clicked_row >= this->vscroll->GetCount()) { this->clicked_row = UINT_MAX; - DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); } } @@ -538,7 +538,7 @@ static WindowDesc _newgrf_parameters_desc( static void OpenGRFParameterWindow(GRFConfig *c, bool editable) { - DeleteWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_GRF_PARAMETERS); new NewGRFParametersWindow(&_newgrf_parameters_desc, c, editable); } @@ -563,7 +563,7 @@ struct NewGRFTextfileWindow : public TextfileWindow { void ShowNewGRFTextfileWindow(TextfileType file_type, const GRFConfig *c) { - DeleteWindowById(WC_TEXTFILE, file_type); + CloseWindowById(WC_TEXTFILE, file_type); new NewGRFTextfileWindow(file_type, c); } @@ -664,9 +664,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { void Close() override { - DeleteWindowByClass(WC_GRF_PARAMETERS); - DeleteWindowByClass(WC_TEXTFILE); - DeleteWindowByClass(WC_SAVE_PRESET); + CloseWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_SAVE_PRESET); if (this->editable && this->modified && !this->execute && !_exit_game) { CopyGRFConfigList(this->orig_list, this->actives, true); @@ -715,8 +715,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { d->next = (*c)->next; d->CopyParams(**c); if (this->active_sel == *c) { - DeleteWindowByClass(WC_GRF_PARAMETERS); - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_TEXTFILE); this->active_sel = nullptr; } delete *c; @@ -938,7 +938,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { list.emplace_back(new DropDownListCharStringItem(this->grf_presets[i], i, false)); } - this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window + this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window ShowDropDownList(this, std::move(list), this->preset, WID_NS_PRESET_LIST); break; } @@ -962,7 +962,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->grf_presets = GetGRFPresetList(); this->preset = -1; this->InvalidateData(); - this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window + this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window break; case WID_NS_MOVE_UP: { // Move GRF up @@ -1012,8 +1012,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { for (c = this->actives; c != nullptr && i > 0; c = c->next, i--) {} if (this->active_sel != c) { - DeleteWindowByClass(WC_GRF_PARAMETERS); - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_TEXTFILE); } this->active_sel = c; this->avail_sel = nullptr; @@ -1030,8 +1030,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { case WID_NS_REMOVE: { // Remove GRF if (this->active_sel == nullptr || !this->editable) break; - DeleteWindowByClass(WC_GRF_PARAMETERS); - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_TEXTFILE); /* Choose the next GRF file to be the selected file. */ GRFConfig *newsel = this->active_sel->next; @@ -1071,9 +1071,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { uint i = this->vscroll2->GetScrolledRowFromWidget(pt.y, this, WID_NS_AVAIL_LIST); this->active_sel = nullptr; - DeleteWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_GRF_PARAMETERS); if (i < this->avails.size()) { - if (this->avail_sel != this->avails[i]) DeleteWindowByClass(WC_TEXTFILE); + if (this->avail_sel != this->avails[i]) CloseWindowByClass(WC_TEXTFILE); this->avail_sel = this->avails[i]; this->avail_pos = i; } @@ -1107,7 +1107,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { ReloadNewGRFData(); this->InvalidateData(GOID_NEWGRF_CHANGES_APPLIED); } - this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window + this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window break; case WID_NS_VIEW_PARAMETERS: @@ -1132,7 +1132,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { if (!_network_available) { ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); } else { - this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window + this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window ShowMissingContentWindow(this->actives); } @@ -1147,11 +1147,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { void OnNewGRFsScanned() override { - if (this->active_sel == nullptr) DeleteWindowByClass(WC_TEXTFILE); + if (this->active_sel == nullptr) CloseWindowByClass(WC_TEXTFILE); this->avail_sel = nullptr; this->avail_pos = -1; this->avails.ForceRebuild(); - this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window + this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window } void OnDropdownSelect(int widget, int index) override @@ -1167,8 +1167,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->avails.ForceRebuild(); ResetObjectToPlace(); - DeleteWindowByClass(WC_GRF_PARAMETERS); - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_TEXTFILE); this->active_sel = nullptr; this->InvalidateData(GOID_NEWGRF_CHANGES_MADE); } @@ -1331,8 +1331,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { if (this->avail_pos >= 0) { this->active_sel = nullptr; - DeleteWindowByClass(WC_GRF_PARAMETERS); - if (this->avail_sel != this->avails[this->avail_pos]) DeleteWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_GRF_PARAMETERS); + if (this->avail_sel != this->avails[this->avail_pos]) CloseWindowByClass(WC_TEXTFILE); this->avail_sel = this->avails[this->avail_pos]; this->vscroll2->ScrollTowards(this->avail_pos); this->InvalidateData(0); @@ -1497,7 +1497,7 @@ private: { if (this->avail_sel == nullptr || !this->editable || HasBit(this->avail_sel->flags, GCF_INVALID)) return false; - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_TEXTFILE); uint count = 0; GRFConfig **entry = nullptr; @@ -1955,8 +1955,8 @@ static WindowDesc _newgrf_desc( static void NewGRFConfirmationCallback(Window *w, bool confirmed) { if (confirmed) { - DeleteWindowByClass(WC_GRF_PARAMETERS); - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_TEXTFILE); NewGRFWindow *nw = dynamic_cast<NewGRFWindow*>(w); GamelogStartAction(GLAT_GRF); @@ -1978,7 +1978,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed) w->InvalidateData(); ReInitAllWindows(false); - DeleteWindowByClass(WC_BUILD_OBJECT); + CloseWindowByClass(WC_BUILD_OBJECT); } } @@ -1994,7 +1994,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed) */ void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config) { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new NewGRFWindow(&_newgrf_desc, editable, show_params, exec_changes, config); } @@ -2150,7 +2150,7 @@ struct SavePresetWindow : public Window { */ static void ShowSavePresetWindow(const char *initial_text) { - DeleteWindowByClass(WC_SAVE_PRESET); + CloseWindowByClass(WC_SAVE_PRESET); new SavePresetWindow(initial_text); } diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 513624b3e..a8d7c4398 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -699,7 +699,7 @@ static void MoveToNextNewsItem() * there is no status bar but possible news. */ if (FindWindowById(WC_STATUS_BAR, 0) == nullptr) return; - DeleteWindowById(WC_NEWS_WINDOW, 0); // close the newspapers window if shown + CloseWindowById(WC_NEWS_WINDOW, 0); // close the newspapers window if shown _forced_news = nullptr; /* if we're not at the last item, then move on */ @@ -1010,13 +1010,13 @@ static void ShowNewsMessage(const NewsItem *ni) assert(_total_news != 0); /* Delete the news window */ - DeleteWindowById(WC_NEWS_WINDOW, 0); + CloseWindowById(WC_NEWS_WINDOW, 0); /* setup forced news item */ _forced_news = ni; if (_forced_news != nullptr) { - DeleteWindowById(WC_NEWS_WINDOW, 0); + CloseWindowById(WC_NEWS_WINDOW, 0); ShowNewspaper(ni); } } @@ -1251,6 +1251,6 @@ static WindowDesc _message_history_desc( /** Display window with news messages history */ void ShowMessageHistory() { - DeleteWindowById(WC_MESSAGE_HISTORY, 0); + CloseWindowById(WC_MESSAGE_HISTORY, 0); new MessageHistoryWindow(&_message_history_desc); } diff --git a/src/openttd.cpp b/src/openttd.cpp index 5a4e73593..f39b87c87 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1086,13 +1086,13 @@ void SwitchToMode(SwitchMode new_mode) SetDParamStr(0, GetSaveLoadErrorString()); ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR); } else { - DeleteWindowById(WC_SAVELOAD, 0); + CloseWindowById(WC_SAVELOAD, 0); } break; case SM_SAVE_HEIGHTMAP: // Save heightmap. MakeHeightmapScreenshot(_file_to_saveload.name.c_str()); - DeleteWindowById(WC_SAVELOAD, 0); + CloseWindowById(WC_SAVELOAD, 0); break; case SM_GENRANDLAND: // Generate random land within scenario editor diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 2b3715ebd..3205be166 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -843,7 +843,7 @@ public: /* Removed / replaced all orders (after deleting / sharing) */ if (this->selected_order == -1) break; - this->DeleteChildWindows(); + this->CloseChildWindows(); HideDropDownMenu(this); this->selected_order = -1; break; @@ -875,7 +875,7 @@ public: /* Now we are modifying the selected order */ if (to == INVALID_VEH_ORDER_ID) { /* Deleting selected order */ - this->DeleteChildWindows(); + this->CloseChildWindows(); HideDropDownMenu(this); this->selected_order = -1; break; @@ -1174,7 +1174,7 @@ public: } /* This order won't be selected any more, close all child windows and dropdowns */ - this->DeleteChildWindows(); + this->CloseChildWindows(); HideDropDownMenu(this); if (sel == INVALID_VEH_ORDER_ID || this->vehicle->owner != _local_company) { @@ -1700,12 +1700,12 @@ static WindowDesc _other_orders_desc( void ShowOrdersWindow(const Vehicle *v) { - DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false); - DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false); + CloseWindowById(WC_VEHICLE_DETAILS, v->index, false); + CloseWindowById(WC_VEHICLE_TIMETABLE, v->index, false); if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != nullptr) return; /* Using a different WindowDescs for _local_company causes problems. - * Due to this we have to close order windows in ChangeWindowOwner/DeleteCompanyWindows, + * Due to this we have to close order windows in ChangeWindowOwner/CloseCompanyWindows, * because we cannot change switch the WindowDescs and keeping the old WindowDesc results * in crashed due to missing widges. * TODO Rewrite the order GUI to not use different WindowDescs. diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 6fb1ee5a0..630cd18f2 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -407,7 +407,7 @@ void GetKeyboardLayout() */ void ShowOnScreenKeyboard(Window *parent, int button) { - DeleteWindowById(WC_OSK, 0); + CloseWindowById(WC_OSK, 0); GetKeyboardLayout(); new OskWindow(&_osk_desc, parent, button); diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index bb5244ae7..871938d20 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -291,7 +291,7 @@ void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uin */ static void ToggleRailButton_Remove(Window *w) { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); w->ToggleWidgetLoweredState(WID_RAT_REMOVE); w->SetWidgetDirty(WID_RAT_REMOVE); _remove_button_clicked = w->IsWidgetLowered(WID_RAT_REMOVE); @@ -437,7 +437,7 @@ struct BuildRailToolbarWindow : Window { void Close() override { if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) SetViewportCatchmentStation(nullptr, true); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); + if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false); this->Window::Close(); } @@ -743,12 +743,12 @@ struct BuildRailToolbarWindow : Window { this->DisableWidget(WID_RAT_REMOVE); this->SetWidgetDirty(WID_RAT_REMOVE); - DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL); - DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL); - DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL); - DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL); - DeleteWindowById(WC_SELECT_STATION, 0); - DeleteWindowByClass(WC_BUILD_BRIDGE); + CloseWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL); + CloseWindowById(WC_BUILD_STATION, TRANSPORT_RAIL); + CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL); + CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL); + CloseWindowById(WC_SELECT_STATION, 0); + CloseWindowByClass(WC_BUILD_BRIDGE); } void OnPlacePresize(Point pt, TileIndex tile) override @@ -865,7 +865,7 @@ Window *ShowBuildRailToolbar(RailType railtype) if (!Company::IsValidID(_local_company)) return nullptr; if (!ValParamRailtype(railtype)) return nullptr; - DeleteWindowByClass(WC_BUILD_TOOLBAR); + CloseWindowByClass(WC_BUILD_TOOLBAR); _cur_railtype = railtype; _remove_button_clicked = false; return new BuildRailToolbarWindow(&_build_rail_desc, railtype); @@ -1031,7 +1031,7 @@ public: void Close() override { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); this->PickerWindowBase::Close(); } @@ -1347,7 +1347,7 @@ public: this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; case WID_BRAS_PLATFORM_NUM_1: @@ -1381,7 +1381,7 @@ public: this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; } @@ -1416,7 +1416,7 @@ public: this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; } @@ -1450,7 +1450,7 @@ public: this->SetWidgetLoweredState(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN, !_settings_client.gui.station_dragdrop); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; } @@ -1483,7 +1483,7 @@ public: } if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; } @@ -1502,7 +1502,7 @@ public: if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; } } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index c12e94c16..f6ddbae41 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -292,7 +292,7 @@ struct BuildRoadToolbarWindow : Window { void Close() override { if (_game_mode == GM_NORMAL && (this->IsWidgetLowered(WID_ROT_BUS_STATION) || this->IsWidgetLowered(WID_ROT_TRUCK_STATION))) SetViewportCatchmentStation(nullptr, true); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); + if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false); this->Window::Close(); } @@ -313,9 +313,9 @@ struct BuildRoadToolbarWindow : Window { WID_ROT_TRUCK_STATION, WIDGET_LIST_END); if (!can_build) { - DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); - DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); - DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); + CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD); + CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); + CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); } if (_game_mode != GM_EDITOR) { @@ -499,7 +499,7 @@ struct BuildRoadToolbarWindow : Window { case WID_ROT_REMOVE: if (this->IsWidgetDisabled(WID_ROT_REMOVE)) return; - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); ToggleRoadButton_Remove(this); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); break; @@ -592,11 +592,11 @@ struct BuildRoadToolbarWindow : Window { this->SetWidgetDirty(WID_ROT_ONE_WAY); } - DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); - DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); - DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); - DeleteWindowById(WC_SELECT_STATION, 0); - DeleteWindowByClass(WC_BUILD_BRIDGE); + CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD); + CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); + CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); + CloseWindowById(WC_SELECT_STATION, 0); + CloseWindowByClass(WC_BUILD_BRIDGE); } void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override @@ -891,7 +891,7 @@ Window *ShowBuildRoadToolbar(RoadType roadtype) if (!Company::IsValidID(_local_company)) return nullptr; if (!ValParamRoadType(roadtype)) return nullptr; - DeleteWindowByClass(WC_BUILD_TOOLBAR); + CloseWindowByClass(WC_BUILD_TOOLBAR); _cur_roadtype = roadtype; return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD); @@ -975,7 +975,7 @@ static WindowDesc _build_tramway_scen_desc( */ Window *ShowBuildRoadScenToolbar(RoadType roadtype) { - DeleteWindowById(WC_SCEN_BUILD_TOOLBAR, TRANSPORT_ROAD); + CloseWindowById(WC_SCEN_BUILD_TOOLBAR, TRANSPORT_ROAD); _cur_roadtype = roadtype; return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_scen_desc : &_build_tramway_scen_desc, TRANSPORT_ROAD); @@ -1098,7 +1098,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { void Close() override { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); this->PickerWindowBase::Close(); } @@ -1159,7 +1159,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; case WID_BROS_LT_OFF: diff --git a/src/screenshot_gui.cpp b/src/screenshot_gui.cpp index c0e65f13d..e9b989e51 100644 --- a/src/screenshot_gui.cpp +++ b/src/screenshot_gui.cpp @@ -69,6 +69,6 @@ static WindowDesc _screenshot_window_desc( void ShowScreenshotWindow() { - DeleteWindowById(WC_SCREENSHOT, 0); + CloseWindowById(WC_SCREENSHOT, 0); new ScreenshotWindow(&_screenshot_window_desc); } diff --git a/src/script/api/script_window.cpp b/src/script/api/script_window.cpp index f54b4fd60..7969380cb 100644 --- a/src/script/api/script_window.cpp +++ b/src/script/api/script_window.cpp @@ -20,11 +20,11 @@ if (ScriptGame::IsMultiplayer()) return; if (number == NUMBER_ALL) { - DeleteWindowByClass((::WindowClass)window); + CloseWindowByClass((::WindowClass)window); return; } - DeleteWindowById((::WindowClass)window, number); + CloseWindowById((::WindowClass)window, number); } /* static */ bool ScriptWindow::IsOpen(WindowClass window, uint32 number) diff --git a/src/settings.cpp b/src/settings.cpp index 11dff7143..c26b3bb47 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -842,7 +842,7 @@ static void StationSpreadChanged(int32 p1) static void CloseSignalGUI(int32 new_value) { if (new_value == 0) { - DeleteWindowByClass(WC_BUILD_SIGNAL); + CloseWindowByClass(WC_BUILD_SIGNAL); } } @@ -980,7 +980,7 @@ static void RoadVehSlopeSteepnessChanged(int32 new_value) static void TownFoundingChanged(int32 new_value) { if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) { - DeleteWindowById(WC_FOUND_TOWN, 0); + CloseWindowById(WC_FOUND_TOWN, 0); } else { InvalidateWindowData(WC_FOUND_TOWN, 0); } @@ -1015,7 +1015,7 @@ static void SpriteZoomMinChanged(int32 new_value) static void InvalidateNewGRFChangeWindows(int32 new_value) { InvalidateWindowClassesData(WC_SAVELOAD); - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); ReInitAllWindows(_gui_zoom_cfg); } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 6fae298bc..f038617d1 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -137,7 +137,7 @@ struct BaseSetTextfileWindow : public TextfileWindow { template <class TBaseSet> void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type) { - DeleteWindowById(WC_TEXTFILE, file_type); + CloseWindowById(WC_TEXTFILE, file_type); new BaseSetTextfileWindow<TBaseSet>(file_type, baseset, content_type); } @@ -174,8 +174,8 @@ struct GameOptionsWindow : Window { void Close() override { - DeleteWindowById(WC_CUSTOM_CURRENCY, 0); - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowById(WC_CUSTOM_CURRENCY, 0); + CloseWindowByClass(WC_TEXTFILE); if (this->reload) _switch_mode = SM_MENU; this->Window::Close(); } @@ -532,7 +532,7 @@ struct GameOptionsWindow : Window { case WID_GO_LANG_DROPDOWN: // Change interface language ReadLanguagePack(&_languages[index]); - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); CheckForMissingGlyphs(); ClearAllCachedNames(); UpdateAllVirtCoords(); @@ -744,7 +744,7 @@ static WindowDesc _game_options_desc( /** Open the game options window. */ void ShowGameOptions() { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new GameOptionsWindow(&_game_options_desc); } @@ -2479,7 +2479,7 @@ static WindowDesc _settings_selection_desc( /** Open advanced settings window. */ void ShowGameSettings() { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new GameSettingsWindow(&_settings_selection_desc); } @@ -2771,6 +2771,6 @@ static WindowDesc _cust_currency_desc( /** Open custom currency window. */ static void ShowCustCurrency() { - DeleteWindowById(WC_CUSTOM_CURRENCY, 0); + CloseWindowById(WC_CUSTOM_CURRENCY, 0); new CustomCurrencyWindow(&_cust_currency_desc); } diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index d7d93c905..27c618087 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -579,7 +579,7 @@ void HandleClickOnSign(const Sign *si) void ShowRenameSignWindow(const Sign *si) { /* Delete all other edit windows */ - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); new SignWindow(&_query_sign_edit_desc, si); } diff --git a/src/station.cpp b/src/station.cpp index 892677312..877f53d4e 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -55,10 +55,10 @@ BaseStation::~BaseStation() if (CleaningPool()) return; - DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).Pack()); - DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->index).Pack()); - DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).Pack()); - DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack()); + CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).Pack()); + CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->index).Pack()); + CloseWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).Pack()); + CloseWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack()); this->sign.MarkDirty(); } @@ -143,7 +143,7 @@ Station::~Station() InvalidateWindowData(WC_STATION_LIST, this->owner, 0); } - DeleteWindowById(WC_STATION_VIEW, index); + CloseWindowById(WC_STATION_VIEW, index); /* Now delete all orders that go to the station */ RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index); diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 3e40ba3fc..52c7bc756 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2396,7 +2396,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags) for (uint i = 0; i < st->airport.GetNumHangars(); ++i) { TileIndex tile_cur = st->airport.GetHangarTile(i); OrderBackup::Reset(tile_cur, false); - DeleteWindowById(WC_VEHICLE_DEPOT, tile_cur); + CloseWindowById(WC_VEHICLE_DEPOT, tile_cur); } const AirportSpec *as = st->airport.GetSpec(); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 7fb1b66a4..ffd4f14a7 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1336,10 +1336,10 @@ struct StationViewWindow : public Window { void Close() override { - DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false); - DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->window_number).Pack(), false); - DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->window_number).Pack(), false); - DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->window_number).Pack(), false); + CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false); + CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->window_number).Pack(), false); + CloseWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->window_number).Pack(), false); + CloseWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->window_number).Pack(), false); SetViewportCatchmentStation(Station::Get(this->window_number), false); this->Window::Close(); @@ -2353,7 +2353,7 @@ struct SelectStationWindow : Window { DoCommandP(&this->select_station_cmd); /* Close Window; this might cause double frees! */ - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } void OnRealtimeTick(uint delta_ms) override diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini index 51481e1c7..afa6db52f 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -1218,7 +1218,7 @@ from = SLV_106 def = true str = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT -post_cb = [](auto) { DeleteWindowById(WC_SELECT_STATION, 0); } +post_cb = [](auto) { CloseWindowById(WC_SELECT_STATION, 0); } ## [SDT_BOOL] diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 0e1896a44..6094c710f 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -364,7 +364,7 @@ Window *ShowTerraformToolbar(Window *link) } /* Delete the terraform toolbar to place it again. */ - DeleteWindowById(WC_SCEN_LAND_GEN, 0, true); + CloseWindowById(WC_SCEN_LAND_GEN, 0, true); w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0); /* Align the terraform toolbar under the main toolbar. */ w->top -= w->height; diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index fa0e4d114..4853181b3 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -237,7 +237,7 @@ struct TimetableWindow : Window { /* Removed / replaced all orders (after deleting / sharing) */ if (this->sel_index == -1) break; - this->DeleteChildWindows(); + this->CloseChildWindows(); this->sel_index = -1; break; @@ -276,7 +276,7 @@ struct TimetableWindow : Window { /* Now we are modifying the selected order */ if (to == INVALID_VEH_ORDER_ID) { /* Deleting selected order */ - this->DeleteChildWindows(); + this->CloseChildWindows(); this->sel_index = -1; break; } else { @@ -523,7 +523,7 @@ struct TimetableWindow : Window { case WID_VT_TIMETABLE_PANEL: { // Main panel. int selected = GetOrderFromTimetableWndPt(pt.y, v); - this->DeleteChildWindows(); + this->CloseChildWindows(); this->sel_index = (selected == INVALID_ORDER || selected == this->sel_index) ? -1 : selected; break; } @@ -707,7 +707,7 @@ static WindowDesc _timetable_desc( */ void ShowTimetableWindow(const Vehicle *v) { - DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false); - DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false); + CloseWindowById(WC_VEHICLE_DETAILS, v->index, false); + CloseWindowById(WC_VEHICLE_ORDERS, v->index, false); AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index); } diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index ee1ac343e..627d133b5 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -104,7 +104,7 @@ Town::~Town() /* Delete town authority window * and remove from list of sorted towns */ - DeleteWindowById(WC_TOWN_VIEW, this->index); + CloseWindowById(WC_TOWN_VIEW, this->index); /* Check no industry is related to us. */ #ifdef WITH_ASSERT diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 77ffa0161..47895122b 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1293,11 +1293,11 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u */ if (src == original_src_head && src->IsEngine() && !src->IsFrontEngine()) { /* Cases #2 and #3: the front engine gets trashed. */ - DeleteWindowById(WC_VEHICLE_VIEW, src->index); - DeleteWindowById(WC_VEHICLE_ORDERS, src->index); - DeleteWindowById(WC_VEHICLE_REFIT, src->index); - DeleteWindowById(WC_VEHICLE_DETAILS, src->index); - DeleteWindowById(WC_VEHICLE_TIMETABLE, src->index); + CloseWindowById(WC_VEHICLE_VIEW, src->index); + CloseWindowById(WC_VEHICLE_ORDERS, src->index); + CloseWindowById(WC_VEHICLE_REFIT, src->index); + CloseWindowById(WC_VEHICLE_DETAILS, src->index); + CloseWindowById(WC_VEHICLE_TIMETABLE, src->index); DeleteNewGRFInspectWindow(GSF_TRAINS, src->index); SetWindowDirty(WC_COMPANY, _current_company); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 90accdd80..3c3125606 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -843,11 +843,11 @@ void Vehicle::PreDestructor() } if (this->IsPrimaryVehicle()) { - DeleteWindowById(WC_VEHICLE_VIEW, this->index); - DeleteWindowById(WC_VEHICLE_ORDERS, this->index); - DeleteWindowById(WC_VEHICLE_REFIT, this->index); - DeleteWindowById(WC_VEHICLE_DETAILS, this->index); - DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index); + CloseWindowById(WC_VEHICLE_VIEW, this->index); + CloseWindowById(WC_VEHICLE_ORDERS, this->index); + CloseWindowById(WC_VEHICLE_REFIT, this->index); + CloseWindowById(WC_VEHICLE_DETAILS, this->index); + CloseWindowById(WC_VEHICLE_TIMETABLE, this->index); SetWindowDirty(WC_COMPANY, this->owner); OrderBackup::ClearVehicle(this); } @@ -2795,7 +2795,7 @@ void Vehicle::RemoveFromShared() if (this->orders.list->GetNumVehicles() == 1) { /* When there is only one vehicle, remove the shared order list window. */ - DeleteWindowById(GetWindowClassForVehicleType(this->type), vli.Pack()); + CloseWindowById(GetWindowClassForVehicleType(this->type), vli.Pack()); InvalidateVehicleOrder(this->FirstShared(), VIWD_MODIFY_ORDERS); } else if (were_first) { /* If we were the first one, update to the new first one. diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 28155f724..65e793132 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1118,7 +1118,7 @@ static WindowDesc _vehicle_refit_desc( */ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit) { - DeleteWindowById(WC_VEHICLE_REFIT, v->index); + CloseWindowById(WC_VEHICLE_REFIT, v->index); RefitWindow *w = new RefitWindow(&_vehicle_refit_desc, v, order, auto_refit); w->parent = parent; } @@ -2462,8 +2462,8 @@ static WindowDesc _nontrain_vehicle_details_desc( /** Shows the vehicle details window of the given vehicle. */ static void ShowVehicleDetailsWindow(const Vehicle *v) { - DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false); - DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false); + CloseWindowById(WC_VEHICLE_ORDERS, v->index, false); + CloseWindowById(WC_VEHICLE_TIMETABLE, v->index, false); AllocateWindowDescFront<VehicleDetailsWindow>((v->type == VEH_TRAIN) ? &_train_vehicle_details_desc : &_nontrain_vehicle_details_desc, v->index); } @@ -2720,10 +2720,10 @@ public: void Close() override { - DeleteWindowById(WC_VEHICLE_ORDERS, this->window_number, false); - DeleteWindowById(WC_VEHICLE_REFIT, this->window_number, false); - DeleteWindowById(WC_VEHICLE_DETAILS, this->window_number, false); - DeleteWindowById(WC_VEHICLE_TIMETABLE, this->window_number, false); + CloseWindowById(WC_VEHICLE_ORDERS, this->window_number, false); + CloseWindowById(WC_VEHICLE_REFIT, this->window_number, false); + CloseWindowById(WC_VEHICLE_DETAILS, this->window_number, false); + CloseWindowById(WC_VEHICLE_TIMETABLE, this->window_number, false); this->Window::Close(); } diff --git a/src/viewport.cpp b/src/viewport.cpp index d3488317e..f9310dac8 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2647,7 +2647,7 @@ static inline void ShowMeasurementTooltips(StringID str, uint paramcount, const static void HideMeasurementTooltips() { - DeleteWindowById(WC_TOOLTIPS, 0); + CloseWindowById(WC_TOOLTIPS, 0); } /** highlighting tiles while only going over them with the mouse */ diff --git a/src/waypoint.cpp b/src/waypoint.cpp index f602eee6d..db1b36b1e 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -51,7 +51,7 @@ void Waypoint::GetTileArea(TileArea *ta, StationType type) const Waypoint::~Waypoint() { if (CleaningPool()) return; - DeleteWindowById(WC_WAYPOINT_VIEW, this->index); + CloseWindowById(WC_WAYPOINT_VIEW, this->index); RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index); if (this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index)); } diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index 946d123c5..4dd2397b7 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -76,7 +76,7 @@ public: void Close() override { - DeleteWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false); + CloseWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false); this->Window::Close(); } diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 77b54d564..f104be68c 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -355,7 +355,7 @@ struct DropdownWindow : Window { */ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width, bool instant_close) { - DeleteWindowById(WC_DROPDOWN_MENU, 0); + CloseWindowById(WC_DROPDOWN_MENU, 0); /* The preferred position is just below the dropdown calling widget */ int top = w->top + wi_rect.bottom + 1; diff --git a/src/window.cpp b/src/window.cpp index aae3efffb..aead815ec 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1076,10 +1076,10 @@ static Window *FindChildWindow(const Window *w, WindowClass wc) } /** - * Delete all children a window might have in a head-recursive manner + * Close all children a window might have in a head-recursive manner * @param wc Window class of the window to remove; #WC_INVALID if class does not matter */ -void Window::DeleteChildWindows(WindowClass wc) const +void Window::CloseChildWindows(WindowClass wc) const { Window *child = FindChildWindow(this, wc); while (child != nullptr) { @@ -1118,7 +1118,7 @@ void Window::Close() _focused_window = nullptr; } - this->DeleteChildWindows(); + this->CloseChildWindows(); this->SetDirty(); @@ -1170,12 +1170,12 @@ Window *FindWindowByClass(WindowClass cls) } /** - * Delete a window by its class and window number (if it is open). + * Close a window by its class and window number (if it is open). * @param cls Window class * @param number Number of the window within the window class - * @param force force deletion; if false don't delete when stickied + * @param force force closing; if false don't close when stickied */ -void DeleteWindowById(WindowClass cls, WindowNumber number, bool force) +void CloseWindowById(WindowClass cls, WindowNumber number, bool force) { Window *w = FindWindowById(cls, number); if (w != nullptr && (force || (w->flags & WF_STICKY) == 0)) { @@ -1184,10 +1184,10 @@ void DeleteWindowById(WindowClass cls, WindowNumber number, bool force) } /** - * Delete all windows of a given class + * Close all windows of a given class * @param cls Window class of windows to delete */ -void DeleteWindowByClass(WindowClass cls) +void CloseWindowByClass(WindowClass cls) { /* Note: the container remains stable, even when deleting windows. */ for (Window *w : Window::Iterate()) { @@ -1198,12 +1198,12 @@ void DeleteWindowByClass(WindowClass cls) } /** - * Delete all windows of a company. We identify windows of a company + * Close all windows of a company. We identify windows of a company * by looking at the caption colour. If it is equal to the company ID - * then we say the window belongs to the company and should be deleted + * then we say the window belongs to the company and should be closed * @param id company identifier */ -void DeleteCompanyWindows(CompanyID id) +void CloseCompanyWindows(CompanyID id) { /* Note: the container remains stable, even when deleting windows. */ for (Window *w : Window::Iterate()) { @@ -1213,7 +1213,7 @@ void DeleteCompanyWindows(CompanyID id) } /* Also delete the company specific windows that don't have a company-colour. */ - DeleteWindowById(WC_BUY_COMPANY, id); + CloseWindowById(WC_BUY_COMPANY, id); } /** @@ -2307,7 +2307,7 @@ static void StartWindowDrag(Window *w) _drag_delta.y = w->top - _cursor.pos.y; BringWindowToFront(w); - DeleteWindowById(WC_DROPDOWN_MENU, 0); + CloseWindowById(WC_DROPDOWN_MENU, 0); } /** @@ -2325,7 +2325,7 @@ static void StartWindowSizing(Window *w, bool to_left) _drag_delta.y = _cursor.pos.y; BringWindowToFront(w); - DeleteWindowById(WC_DROPDOWN_MENU, 0); + CloseWindowById(WC_DROPDOWN_MENU, 0); } /** @@ -3253,12 +3253,12 @@ void CallWindowGameTickEvent() } /** - * Try to delete a non-vital window. + * Try to close a non-vital window. * Non-vital windows are windows other than the game selection, main toolbar, * status bar, toolbar menu, and tooltip windows. Stickied windows are also * considered vital. */ -void DeleteNonVitalWindows() +void CloseNonVitalWindows() { /* Note: the container remains stable, even when deleting windows. */ for (Window *w : Window::Iterate()) { @@ -3281,12 +3281,12 @@ void DeleteNonVitalWindows() * then, does a little hacked loop of closing all stickied windows. Note * that standard windows (status bar, etc.) are not stickied, so these aren't affected */ -void DeleteAllNonVitalWindows() +void CloseAllNonVitalWindows() { - /* Delete every window except for stickied ones, then sticky ones as well */ - DeleteNonVitalWindows(); + /* Close every window except for stickied ones, then sticky ones as well */ + CloseNonVitalWindows(); - /* Note: the container remains stable, even when deleting windows. */ + /* Note: the container remains stable, even when closing windows. */ for (Window *w : Window::Iterate()) { if (w->flags & WF_STICKY) { w->Close(); @@ -3295,21 +3295,21 @@ void DeleteAllNonVitalWindows() } /** - * Delete all messages and their corresponding window (if any). + * Delete all messages and close their corresponding window (if any). */ void DeleteAllMessages() { InitNewsItemStructs(); InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar InvalidateWindowData(WC_MESSAGE_HISTORY, 0); // invalidate the message history - DeleteWindowById(WC_NEWS_WINDOW, 0); // close newspaper or general message window if shown + CloseWindowById(WC_NEWS_WINDOW, 0); // close newspaper or general message window if shown } /** - * Delete all windows that are used for construction of vehicle etc. + * Close all windows that are used for construction of vehicle etc. * Once done with that invalidate the others to ensure they get refreshed too. */ -void DeleteConstructionWindows() +void CloseConstructionWindows() { /* Note: the container remains stable, even when deleting windows. */ for (Window *w : Window::Iterate()) { @@ -3321,11 +3321,11 @@ void DeleteConstructionWindows() for (const Window *w : Window::Iterate()) w->SetDirty(); } -/** Delete all always on-top windows to get an empty screen */ +/** Close all always on-top windows to get an empty screen */ void HideVitalWindows() { - DeleteWindowById(WC_MAIN_TOOLBAR, 0); - DeleteWindowById(WC_STATUS_BAR, 0); + CloseWindowById(WC_MAIN_TOOLBAR, 0); + CloseWindowById(WC_STATUS_BAR, 0); } /** Re-initialize all windows. */ @@ -3443,7 +3443,7 @@ void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index) */ void RelocateAllWindows(int neww, int newh) { - DeleteWindowById(WC_DROPDOWN_MENU, 0); + CloseWindowById(WC_DROPDOWN_MENU, 0); for (Window *w : Window::Iterate()) { int left, top; diff --git a/src/window_func.h b/src/window_func.h index fba00944a..d68b7ba1c 100644 --- a/src/window_func.h +++ b/src/window_func.h @@ -36,10 +36,10 @@ void InputLoop(); void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0, bool gui_scope = false); void InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope = false); -void DeleteNonVitalWindows(); -void DeleteAllNonVitalWindows(); +void CloseNonVitalWindows(); +void CloseAllNonVitalWindows(); void DeleteAllMessages(); -void DeleteConstructionWindows(); +void CloseConstructionWindows(); void HideVitalWindows(); void ShowVitalWindows(); @@ -53,8 +53,8 @@ void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_inde void SetWindowDirty(WindowClass cls, WindowNumber number); void SetWindowClassesDirty(WindowClass cls); -void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true); -void DeleteWindowByClass(WindowClass cls); +void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true); +void CloseWindowByClass(WindowClass cls); bool EditBoxInGlobalFocus(); bool FocusedWindowIsConsole(); diff --git a/src/window_gui.h b/src/window_gui.h index c84ad333b..58d14a54e 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -509,7 +509,7 @@ public: void DrawSortButtonState(int widget, SortButtonState state) const; static int SortButtonWidth(); - void DeleteChildWindows(WindowClass wc = WC_INVALID) const; + void CloseChildWindows(WindowClass wc = WC_INVALID) const; virtual void Close(); static void DeleteClosedWindows(); |