diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index fb0123bf0a..1fab76537a 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -117,7 +117,7 @@ cur_company.Restore(); InvalidateWindowData(WC_SCRIPT_DEBUG, 0, -1); - DeleteWindowById(WC_SCRIPT_SETTINGS, company); + CloseWindowById(WC_SCRIPT_SETTINGS, company); } /* static */ void AI::Pause(CompanyID company) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 02743dec9f..d991a78724 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -100,8 +100,8 @@ struct AIConfigWindow : public Window { ~AIConfigWindow() { - DeleteWindowByClass(WC_SCRIPT_LIST); - DeleteWindowByClass(WC_SCRIPT_SETTINGS); + CloseWindowByClass(WC_SCRIPT_LIST); + CloseWindowByClass(WC_SCRIPT_SETTINGS); } void SetStringParameters(int widget) const override @@ -291,6 +291,6 @@ struct AIConfigWindow : public Window { /** Open the AI config window. */ void ShowAIConfigWindow() { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new AIConfigWindow(); } diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 91e5d4af5b..441797b8d9 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -81,7 +81,7 @@ struct BuildAirToolbarWindow : Window { ~BuildAirToolbarWindow() { 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); } /** @@ -98,7 +98,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(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); @@ -160,8 +160,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; @@ -219,7 +219,7 @@ Window *ShowBuildAirToolbar() { if (!Company::IsValidID(_local_company)) return nullptr; - DeleteWindowByClass(WC_BUILD_TOOLBAR); + CloseWindowByClass(WC_BUILD_TOOLBAR); return AllocateWindowDescFront(&_air_toolbar_desc, TRANSPORT_AIR); } @@ -280,7 +280,7 @@ public: virtual ~BuildAirportWindow() { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } void SetStringParameters(int widget) const override diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index d52b7bbf34..7979495d06 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -932,7 +932,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 6e426c53c6..3f7c6837aa 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -377,7 +377,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 ce76b33872..3fcf283e84 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -3276,7 +3276,7 @@ void ShowBuildVehicleWindow(const TileIndex tile, const VehicleType type) assert(IsCompanyBuildableVehicleType(type)); - DeleteWindowById(WC_BUILD_VEHICLE, num); + CloseWindowById(WC_BUILD_VEHICLE, num); if (type == VEH_TRAIN && _settings_client.gui.dual_pane_train_purchase_window) { new BuildVehicleWindowTrainAdvanced(&_build_vehicle_desc_train_advanced, tile, nullptr); @@ -3289,7 +3289,7 @@ void ShowTemplateTrainBuildVehicleWindow(Train **virtual_train) { assert(IsCompanyBuildableVehicleType(VEH_TRAIN)); - DeleteWindowById(WC_BUILD_VIRTUAL_TRAIN, 0); + CloseWindowById(WC_BUILD_VIRTUAL_TRAIN, 0); if (_settings_client.gui.dual_pane_train_purchase_window) { new BuildVehicleWindowTrainAdvanced(&_build_template_vehicle_desc_advanced, INVALID_TILE, virtual_train); diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 5105697b0b..55603424ed 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -528,7 +528,7 @@ static WindowDesc _cheats_desc( /** Open cheat window. */ void ShowCheatWindow() { - DeleteWindowById(WC_CHEATS, 0); + CloseWindowById(WC_CHEATS, 0); if (!_networking || _network_server || _network_settings_access || _settings_game.difficulty.money_cheat_in_multiplayer) { new CheatWindow(&_cheats_desc); } diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 62568219ab..f3ef4267ec 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -131,8 +131,8 @@ void SetLocalCompany(CompanyID new_company) if (switching_company) { InvalidateWindowClassesData(WC_COMPANY); - /* Delete any construction windows... */ - DeleteConstructionWindows(); + /* Close any construction windows... */ + CloseConstructionWindows(); ResetObjectToPlace(); } @@ -752,7 +752,7 @@ static void HandleBankruptcyTakeover(Company *c) if (best_performance == -1) { if (c->bankrupt_flags & CBRF_SALE_ONLY) { c->bankrupt_asked = 0; - DeleteWindowById(WC_BUY_COMPANY, c->index); + CloseWindowById(WC_BUY_COMPANY, c->index); } else { c->bankrupt_asked = MAX_UVALUE(CompanyMask); } @@ -913,7 +913,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(DSNC_NONE); @@ -1023,7 +1023,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 c->bankrupt_value = CalculateCompanyValue(c, false); c->bankrupt_asked = 1 << c->index; // Don't ask the owner c->bankrupt_timeout = 0; - DeleteWindowById(WC_BUY_COMPANY, c->index); + CloseWindowById(WC_BUY_COMPANY, c->index); break; } diff --git a/src/console_gui.cpp b/src/console_gui.cpp index a1f4ed7df7..7c41fc9bdd 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -404,7 +404,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 7d4babee97..3a1f5b3c57 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -365,7 +365,7 @@ static WindowDesc _set_minutes_desc( void ShowSetDateWindow(Window *parent, int window_number, DateTicksScaled initial_date, Year min_year, Year max_year, SetDateCallback *callback, StringID button_text, StringID button_tooltip) { - DeleteWindowByClass(WC_SET_DATE); + CloseWindowByClass(WC_SET_DATE); if (!_settings_time.time_in_minutes) { new SetDateWindow(&_set_date_desc, window_number, parent, ScaledDateTicksToDate(initial_date), min_year, max_year, callback, button_text, button_tooltip); diff --git a/src/depot.cpp b/src/depot.cpp index 5819c3b0fd..a6633f1061 100644 --- a/src/depot.cpp +++ b/src/depot.cpp @@ -44,9 +44,9 @@ Depot::~Depot() TraceRestrictRemoveDestinationID(TROCAF_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 76827f8546..3c3245d9a2 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -298,8 +298,8 @@ struct DepotWindow : Window { ~DepotWindow() { - 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); } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index e64bfa256b..93eaf13660 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -109,7 +109,7 @@ struct BuildDocksToolbarWindow : Window { ~BuildDocksToolbarWindow() { 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); } /** @@ -128,8 +128,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) { @@ -266,10 +266,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 @@ -366,7 +366,7 @@ Window *ShowBuildDocksToolbar() { if (!Company::IsValidID(_local_company)) return nullptr; - DeleteWindowByClass(WC_BUILD_TOOLBAR); + CloseWindowByClass(WC_BUILD_TOOLBAR); return AllocateWindowDescFront(&_build_docks_toolbar_desc, TRANSPORT_WATER); } @@ -427,7 +427,7 @@ public: virtual ~BuildDocksStationWindow() { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } void OnPaint() override diff --git a/src/economy.cpp b/src/economy.cpp index 351a5e6d2c..55c5d5c834 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -679,7 +679,7 @@ static void CompanyCheckBankrupt(Company *c) int previous_months_of_bankruptcy = CeilDiv(c->months_of_bankruptcy, 3); c->months_of_bankruptcy = 0; c->bankrupt_asked = 0; - DeleteWindowById(WC_BUY_COMPANY, c->index); + CloseWindowById(WC_BUY_COMPANY, c->index); if (previous_months_of_bankruptcy != 0) CompanyAdminUpdate(c); return; } diff --git a/src/engine.cpp b/src/engine.cpp index f962124842..97a66258a5 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -608,7 +608,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); @@ -991,7 +991,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) { @@ -1169,7 +1169,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 ff6fa17e68..d2cc0f2c75 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -953,7 +953,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/game/game_gui.cpp b/src/game/game_gui.cpp index 62a97ec7b6..34f4e4550b 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -114,7 +114,7 @@ struct GSConfigWindow : public Window { ~GSConfigWindow() { HideDropDownMenu(this); - DeleteWindowByClass(WC_SCRIPT_LIST); + CloseWindowByClass(WC_SCRIPT_LIST); } /** @@ -281,7 +281,7 @@ struct GSConfigWindow : public Window { int num = it - this->visible_settings.begin(); if (this->clicked_row != num) { - this->DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); HideDropDownMenu(this); this->clicked_row = num; this->clicked_dropdown = false; @@ -419,7 +419,7 @@ struct GSConfigWindow : public Window { } this->RebuildVisibleSettings(); HideDropDownMenu(this); - this->DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); } private: bool IsEditableItem(const ScriptConfigItem &config_item) const @@ -442,6 +442,6 @@ private: /** Open the GS config window. */ void ShowGSConfigWindow() { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new GSConfigWindow(); } diff --git a/src/genworld.cpp b/src/genworld.cpp index 8a1a7f5910..bed2609371 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -79,7 +79,7 @@ static void CleanupGeneration() _gw.proc = nullptr; _gw.abortp = nullptr; - DeleteWindowByClass(WC_MODAL_PROGRESS); + CloseWindowByClass(WC_MODAL_PROGRESS); ShowFirstError(); MarkWholeScreenDirty(); } @@ -332,7 +332,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 4e9887f5fe..caf0f2bdd0 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -352,7 +352,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 */ @@ -1172,7 +1172,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(); @@ -1479,7 +1479,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 4cde61eebb..c1041b4dcb 100644 --- a/src/goal.cpp +++ b/src/goal.cpp @@ -341,13 +341,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 d1a34a39e9..7ae227c358 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -447,7 +447,7 @@ CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 TraceRestrictRemoveGroupID(g->index); /* 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 37604ba874..a74bc6faca 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -523,7 +523,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 2982e70824..a63d32e761 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -229,7 +229,7 @@ static WindowDesc _endgame_desc( */ void ShowHighscoreTable(int difficulty, int8 ranking) { - DeleteWindowByClass(WC_HIGHSCORE); + CloseWindowByClass(WC_HIGHSCORE); new HighScoreWindow(&_highscore_desc, difficulty, ranking); } @@ -243,6 +243,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 4f08a5ca98..5aca3ca6a8 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -189,7 +189,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(SourceType::Industry, this->index); diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 75ae7f7e8d..36992fd7af 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -350,8 +350,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 23a00ea917..1aa8a838b3 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -408,7 +408,7 @@ public: */ void ShowLandInfo(TileIndex tile) { - DeleteWindowById(WC_LAND_INFO, 0); + CloseWindowById(WC_LAND_INFO, 0); new LandInfoWindow(tile); } @@ -581,7 +581,7 @@ struct AboutWindow : public Window { void ShowAboutWindow() { - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); new AboutWindow(); } @@ -843,7 +843,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; @@ -1184,7 +1184,7 @@ static WindowDesc _query_string_desc( */ void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags) { - 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); } @@ -1287,7 +1287,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/core/tcp_game.cpp b/src/network/core/tcp_game.cpp index 68094a147e..b191025b87 100644 --- a/src/network/core/tcp_game.cpp +++ b/src/network/core/tcp_game.cpp @@ -112,7 +112,7 @@ NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool error) /* Clients drop back to the main menu */ if (!_network_server && _networking) { ClientNetworkEmergencySave(); - DeleteNetworkClientWindows(); + CloseNetworkClientWindows(); _switch_mode = SM_MENU; _networking = false; ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL); diff --git a/src/network/network.cpp b/src/network/network.cpp index f5ae9e3ffe..5e308fef7d 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -1035,7 +1035,7 @@ void NetworkDisconnect(bool blocking, bool close_admins) } } - 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 1601b59c42..2877c37093 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -532,6 +532,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 9f92cbf03a..0621283cc6 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -237,7 +237,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; } @@ -267,8 +267,8 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res) ClientNetworkEmergencySave(); } - DeleteNetworkClientWindows(); - DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); + CloseNetworkClientWindows(); + CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN); if (_game_mode != GM_MENU) _switch_mode = SM_MENU; _networking = false; @@ -1395,7 +1395,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SETTINGS_ACCESS _network_settings_access = p->Recv_bool(); - DeleteWindowById(WC_CHEATS, 0); + CloseWindowById(WC_CHEATS, 0); ReInitAllWindows(false); return NETWORK_RECV_STATUS_OKAY; diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 98fc90c36a..4707b8b3b8 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -502,7 +502,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); @@ -536,7 +536,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 3ad8255411..faf7a7cd0f 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -76,7 +76,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); } @@ -293,7 +293,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); } } } @@ -1142,7 +1142,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_coordinator.cpp b/src/network/network_coordinator.cpp index 0181f59f56..654eaeda60 100644 --- a/src/network/network_coordinator.cpp +++ b/src/network/network_coordinator.cpp @@ -648,7 +648,7 @@ void ClientNetworkCoordinatorSocketHandler::CloseStunHandler(const std::string & */ void ClientNetworkCoordinatorSocketHandler::CloseTurnHandler(const std::string &token) { - DeleteWindowByClass(WC_NETWORK_ASK_RELAY); + CloseWindowByClass(WC_NETWORK_ASK_RELAY); auto turn_it = this->turn_handlers.find(token); if (turn_it == this->turn_handlers.end()) return; diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 2101973117..9728033935 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -744,7 +744,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 @@ -1035,7 +1035,7 @@ static WindowDesc _network_game_window_desc( void ShowNetworkGameWindow() { static bool first = true; - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START); /* Only show once */ if (first) { @@ -1309,7 +1309,7 @@ static void ShowNetworkStartServerWindow() { if (!NetworkValidateOurClientName()) return; - DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); + CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME); new NetworkStartServerWindow(&_network_start_server_window_desc); } @@ -2301,7 +2301,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); } @@ -2423,7 +2423,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); } @@ -2532,7 +2532,7 @@ static WindowDesc _network_ask_relay_desc( */ void ShowNetworkAskRelay(const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token) { - DeleteWindowByClass(WC_NETWORK_ASK_RELAY); + CloseWindowByClass(WC_NETWORK_ASK_RELAY); Window *parent = GetMainWindow(); new NetworkAskRelayWindow(&_network_ask_relay_desc, parent, server_connection_string, relay_connection_string, token); diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 8a7ea60e84..85b201a2fa 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -753,7 +753,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 52d8df85ba..831a703801 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -1170,7 +1170,7 @@ void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index) if (index >= (1 << 27)) return; WindowNumber wno = GetInspectWindowNumber(feature, index); - DeleteAllWindowsById(WC_NEWGRF_INSPECT, wno); + CloseAllWindowsById(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 a6d1d1a606..60bef04a45 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -369,7 +369,7 @@ struct NewGRFParametersWindow : public Window { if (num >= this->vscroll->GetCount()) break; if (this->clicked_row != num) { - DeleteChildWindows(WC_QUERY_STRING); + CloseChildWindows(WC_QUERY_STRING); HideDropDownMenu(this); this->clicked_row = num; this->clicked_dropdown = false; @@ -504,7 +504,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); + CloseChildWindows(WC_QUERY_STRING); } } @@ -561,7 +561,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); } @@ -586,7 +586,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); } @@ -688,9 +688,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { ~NewGRFWindow() { - 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); @@ -735,8 +735,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; @@ -964,7 +964,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { list.emplace_back(new DropDownListStringItem(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; } @@ -987,7 +987,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 @@ -1043,8 +1043,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; @@ -1061,8 +1061,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; @@ -1102,9 +1102,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { auto it = this->vscroll2->GetScrolledItemFromWidget(this->avails, pt.y, this, WID_NS_AVAIL_LIST); this->active_sel = nullptr; - DeleteWindowByClass(WC_GRF_PARAMETERS); + CloseWindowByClass(WC_GRF_PARAMETERS); if (it != this->avails.end()) { - if (this->avail_sel != *it) DeleteWindowByClass(WC_TEXTFILE); + if (this->avail_sel != *it) CloseWindowByClass(WC_TEXTFILE); this->avail_sel = *it; this->avail_pos = it - this->avails.begin(); } @@ -1139,7 +1139,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { PostCheckNewGRFLoadWarnings(); 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: @@ -1164,7 +1164,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); } @@ -1179,11 +1179,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 @@ -1199,8 +1199,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); } @@ -1363,8 +1363,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); @@ -1532,7 +1532,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; @@ -2001,8 +2001,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(w); GamelogStartAction(GLAT_GRF); @@ -2025,7 +2025,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed) w->InvalidateData(); ReInitAllWindows(false); - DeleteWindowByClass(WC_BUILD_OBJECT); + CloseWindowByClass(WC_BUILD_OBJECT); } } @@ -2047,7 +2047,7 @@ void PostCheckNewGRFLoadWarnings() */ 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); } @@ -2205,7 +2205,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 b9773da19a..5f5ef264eb 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -719,7 +719,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 */ @@ -1036,13 +1036,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); } } @@ -1245,6 +1245,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 6e1a4b0c04..18bfb09933 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1434,14 +1434,14 @@ 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_cmd.cpp b/src/order_cmd.cpp index 55c001e676..62411745e3 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -2943,7 +2943,7 @@ void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist, bool reset_order_indic v->RemoveFromShared(); v->orders = nullptr; } else { - DeleteWindowById(GetWindowClassForVehicleType(v->type), VehicleListIdentifier(VL_SHARED_ORDERS, v->type, v->owner, v->index).Pack()); + CloseWindowById(GetWindowClassForVehicleType(v->type), VehicleListIdentifier(VL_SHARED_ORDERS, v->type, v->owner, v->index).Pack()); if (v->orders != nullptr) { /* Remove the orders */ v->orders->FreeChain(keep_orderlist); diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 9fea31758b..5894269398 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -432,7 +432,7 @@ static WindowDesc _cargo_type_unload_orders_widgets ( void ShowCargoTypeOrdersWindow(const Vehicle *v, Window *parent, VehicleOrderID order_id, CargoTypeOrdersWindowVariant variant) { WindowDesc &desc = (variant == CTOWV_LOAD) ? _cargo_type_load_orders_widgets : _cargo_type_unload_orders_widgets; - DeleteWindowById(desc.cls, v->index); + CloseWindowById(desc.cls, v->index); CargoTypeOrdersWindow *w = new CargoTypeOrdersWindow(&desc, v, order_id, variant); w->parent = parent; } @@ -1902,8 +1902,8 @@ public: ~OrdersWindow() { - DeleteWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, this->window_number, false); - DeleteWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, this->window_number, false); + CloseWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, this->window_number, false); + CloseWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, this->window_number, false); if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) { MarkDirtyFocusedRoutePaths(this->vehicle); } @@ -1996,7 +1996,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; @@ -2026,7 +2026,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; @@ -2726,7 +2726,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) { @@ -3981,8 +3981,8 @@ 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. diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 370df28feb..f38056f4e2 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -393,7 +393,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/programmable_signals.cpp b/src/programmable_signals.cpp index f036ec56ab..17250755b6 100644 --- a/src/programmable_signals.cpp +++ b/src/programmable_signals.cpp @@ -538,7 +538,7 @@ SignalProgram *GetSignalProgram(SignalReference ref) void FreeSignalProgram(SignalReference ref) { - DeleteWindowById(WC_SIGNAL_PROGRAM, (ref.tile << 3) | ref.track); + CloseWindowById(WC_SIGNAL_PROGRAM, (ref.tile << 3) | ref.track); ProgramList::iterator i = _signal_programs.find(ref); if (i != _signal_programs.end()) { delete i->second; diff --git a/src/programmable_signals_gui.cpp b/src/programmable_signals_gui.cpp index 5d50c23c60..866f641569 100644 --- a/src/programmable_signals_gui.cpp +++ b/src/programmable_signals_gui.cpp @@ -273,7 +273,7 @@ public: case PROGRAM_WIDGET_INSTRUCTION_LIST: { int sel = this->GetInstructionFromPt(pt.y); - this->DeleteChildWindows(); + this->CloseChildWindows(); HideDropDownMenu(this); if (sel == -1 || this->GetOwner() != _local_company) { diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index d45bd1113a..cfc1598724 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -349,7 +349,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); @@ -519,8 +519,8 @@ struct BuildRailToolbarWindow : Window { { if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) SetViewportCatchmentStation(nullptr, true); if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) SetViewportCatchmentWaypoint(nullptr, true); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); - DeleteWindowById(WC_SELECT_STATION, 0); + if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false); + CloseWindowById(WC_SELECT_STATION, 0); } /** @@ -930,12 +930,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 @@ -1064,7 +1064,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); @@ -1251,7 +1251,7 @@ public: virtual ~BuildRailStationWindow() { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } /** Sort station classes by StationClassID. */ @@ -1549,7 +1549,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: @@ -1581,7 +1581,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; } @@ -1614,7 +1614,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; } @@ -1648,7 +1648,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; } @@ -1670,7 +1670,7 @@ public: this->SelectClass(station_class_id); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; } @@ -1689,7 +1689,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; } } @@ -2518,7 +2518,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { virtual ~BuildRailWaypointWindow() { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override diff --git a/src/road_gui.cpp b/src/road_gui.cpp index b45b4c3367..5bd3a3b014 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -381,8 +381,8 @@ struct BuildRoadToolbarWindow : Window { { if (_game_mode == GM_NORMAL && (this->IsWidgetLowered(WID_ROT_BUS_STATION) || this->IsWidgetLowered(WID_ROT_TRUCK_STATION))) SetViewportCatchmentStation(nullptr, true); if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_ROT_BUILD_WAYPOINT)) SetViewportCatchmentWaypoint(nullptr, true); - if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); - DeleteWindowById(WC_SELECT_STATION, 0); + if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false); + CloseWindowById(WC_SELECT_STATION, 0); } /** @@ -403,10 +403,10 @@ 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); - DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_ROAD); + CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD); + CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); + CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); + CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_ROAD); } if (_game_mode != GM_EDITOR) { @@ -605,7 +605,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; @@ -703,12 +703,12 @@ 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_BUILD_WAYPOINT, 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_BUILD_WAYPOINT, TRANSPORT_ROAD); + CloseWindowById(WC_SELECT_STATION, 0); + CloseWindowByClass(WC_BUILD_BRIDGE); } void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override @@ -1037,7 +1037,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(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD); @@ -1121,7 +1121,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(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_scen_desc : &_build_tramway_scen_desc, TRANSPORT_ROAD); @@ -1273,7 +1273,7 @@ private: _roadstop_gui_settings.orientation = DIAGDIR_END; this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } this->UpdateBuildingHeight(spec->height); } @@ -1379,7 +1379,7 @@ public: virtual ~BuildRoadStationWindow() { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } /** Sort classes by RoadStopClassID. */ @@ -1688,7 +1688,7 @@ public: this->LowerWidget(_roadstop_gui_settings.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: @@ -1708,7 +1708,7 @@ public: this->SelectClass(class_id); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); break; } @@ -1728,7 +1728,7 @@ public: if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); this->CheckSelectedSpec(); break; } @@ -2037,7 +2037,7 @@ struct BuildRoadWaypointWindow : PickerWindowBase { virtual ~BuildRoadWaypointWindow() { - DeleteWindowById(WC_SELECT_STATION, 0); + CloseWindowById(WC_SELECT_STATION, 0); } void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override diff --git a/src/schdispatch_gui.cpp b/src/schdispatch_gui.cpp index 788e29d7a6..5097bb722d 100644 --- a/src/schdispatch_gui.cpp +++ b/src/schdispatch_gui.cpp @@ -664,7 +664,7 @@ struct SchdispatchWindow : GeneralVehicleWindow { const Vehicle *v = this->vehicle; this->clicked_widget = widget; - this->DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); switch (widget) { case WID_SCHDISPATCH_MATRIX: { /* List */ @@ -1242,7 +1242,7 @@ static WindowDesc _scheduled_dispatch_add_desc( void ShowScheduledDispatchAddSlotsWindow(SchdispatchWindow *parent, int window_number) { - DeleteWindowByClass(WC_SET_DATE); + CloseWindowByClass(WC_SET_DATE); new ScheduledDispatchAddSlotsWindow(&_scheduled_dispatch_add_desc, window_number, parent); } diff --git a/src/screenshot_gui.cpp b/src/screenshot_gui.cpp index e5b78c1a7c..ba61928c79 100644 --- a/src/screenshot_gui.cpp +++ b/src/screenshot_gui.cpp @@ -75,7 +75,7 @@ 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 d441151294..42b5614c03 100644 --- a/src/script/api/script_window.cpp +++ b/src/script/api/script_window.cpp @@ -20,13 +20,13 @@ if (ScriptGame::IsMultiplayer()) return; if (number == NUMBER_ALL) { - DeleteWindowByClass((::WindowClass)window); + CloseWindowByClass((::WindowClass)window); return; } number = Clamp(number, 0, INT32_MAX); - DeleteWindowById((::WindowClass)window, number); + CloseWindowById((::WindowClass)window, number); } /* static */ bool ScriptWindow::IsOpen(WindowClass window, SQInteger number) diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index e94a7fae0c..fa06cc0bfe 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -183,7 +183,7 @@ struct ScriptListWindow : public Window { } InvalidateWindowData(WC_GAME_OPTIONS, slot == OWNER_DEITY ? WN_GAME_OPTIONS_GS : WN_GAME_OPTIONS_AI); InvalidateWindowClassesData(WC_SCRIPT_SETTINGS); - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); InvalidateWindowClassesData(WC_TEXTFILE); if (_game_mode == GM_NORMAL && slot == OWNER_DEITY) { InvalidateWindowData(WC_SCRIPT_DEBUG, 0, -1); @@ -282,7 +282,7 @@ static WindowDesc _script_list_desc( */ void ShowScriptListWindow(CompanyID slot, bool show_all) { - DeleteWindowByClass(WC_SCRIPT_LIST); + CloseWindowByClass(WC_SCRIPT_LIST); new ScriptListWindow(&_script_list_desc, slot, show_all); } @@ -447,7 +447,7 @@ struct ScriptSettingsWindow : public Window { int num = it - this->visible_settings.begin(); if (this->clicked_row != num) { - this->DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); HideDropDownMenu(this); this->clicked_row = num; this->clicked_dropdown = false; @@ -577,7 +577,7 @@ struct ScriptSettingsWindow : public Window { { this->RebuildVisibleSettings(); HideDropDownMenu(this); - this->DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); } private: @@ -633,8 +633,8 @@ static WindowDesc _script_settings_desc( */ void ShowScriptSettingsWindow(CompanyID slot) { - DeleteWindowByClass(WC_SCRIPT_LIST); - DeleteWindowByClass(WC_SCRIPT_SETTINGS); + CloseWindowByClass(WC_SCRIPT_LIST); + CloseWindowByClass(WC_SCRIPT_SETTINGS); new ScriptSettingsWindow(&_script_settings_desc, slot); } @@ -674,7 +674,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); } @@ -956,7 +956,7 @@ struct ScriptDebugWindow : public Window { this->highlight_row = -1; // The highlight of one Script make little sense for another Script. /* Close AI settings window to prevent confusion */ - DeleteWindowByClass(WC_SCRIPT_SETTINGS); + CloseWindowByClass(WC_SCRIPT_SETTINGS); this->InvalidateData(-1); diff --git a/src/settings.cpp b/src/settings.cpp index f731997eb8..61522c190c 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1263,7 +1263,7 @@ static void VehListCargoFilterShownChanged(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); } @@ -1336,7 +1336,7 @@ static void DeveloperModeChanged(int32 new_value) static void InvalidateNewGRFChangeWindows(int32 new_value) { InvalidateWindowClassesData(WC_SAVELOAD); - DeleteWindowByClass(WC_GAME_OPTIONS); + CloseWindowByClass(WC_GAME_OPTIONS); ReInitAllWindows(false); } @@ -1510,7 +1510,7 @@ static void DifficultyNoiseChange(int32 new_value) static void DifficultyMoneyCheatMultiplayerChange(int32 new_value) { - DeleteWindowById(WC_CHEATS, 0); + CloseWindowById(WC_CHEATS, 0); } static void DifficultyRenameTownsMultiplayerChange(int32 new_value) diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 8214f9a193..c42736ad5d 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -136,7 +136,7 @@ struct BaseSetTextfileWindow : public TextfileWindow { template void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type) { - DeleteWindowById(WC_TEXTFILE, file_type); + CloseWindowById(WC_TEXTFILE, file_type); new BaseSetTextfileWindow(file_type, baseset, content_type); } @@ -218,8 +218,8 @@ struct GameOptionsWindow : Window { ~GameOptionsWindow() { - DeleteWindowById(WC_CUSTOM_CURRENCY, 0); - DeleteWindowByClass(WC_TEXTFILE); + CloseWindowById(WC_CUSTOM_CURRENCY, 0); + CloseWindowByClass(WC_TEXTFILE); if (this->reload) _switch_mode = SM_MENU; } @@ -730,7 +730,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(); @@ -1010,7 +1010,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); } @@ -3209,7 +3209,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); } @@ -3508,6 +3508,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 993627c9e4..e2040b368e 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -583,7 +583,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 a2b45fe51c..470cefd3de 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -61,12 +61,12 @@ 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()); - DeleteWindowById(WC_DEPARTURES_BOARD, this->index); - DeleteWindowById(WC_STATION_CARGO, this->index); + 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()); + CloseWindowById(WC_DEPARTURES_BOARD, this->index); + CloseWindowById(WC_STATION_CARGO, this->index); } Station::Station(TileIndex tile) : @@ -152,7 +152,7 @@ Station::~Station() InvalidateWindowData(WC_STATION_LIST, this->owner, 0); } - DeleteWindowById(WC_STATION_VIEW, index); + CloseWindowById(WC_STATION_VIEW, index); DeleteNewGRFInspectWindow(GSF_FAKE_STATION_STRUCT, this->index); /* Now delete all orders that go to the station */ diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 7b89aac15d..8823994bc2 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2808,7 +2808,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint 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 *old_as = st->airport.GetSpec(); @@ -2899,7 +2899,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); } ZoningMarkDirtyStationCoverageArea(st); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 5d4801c570..7b92c6cbe3 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1438,10 +1438,10 @@ struct StationViewWindow : public Window { ~StationViewWindow() { ZoningStationWindowOpenClose(Station::Get(window_number)); - 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); } @@ -2611,7 +2611,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 @@ -3103,7 +3103,7 @@ public: }; void GuiShowStationRatingTooltip(Window *parent, const Station *st, const CargoSpec *cs) { - DeleteWindowById(WC_STATION_RATING_TOOLTIP, 0); + CloseWindowById(WC_STATION_RATING_TOOLTIP, 0); new StationRatingTooltipWindow(parent, st, cs); } diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini index eebb9c0018..fcd03ef1db 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -2250,7 +2250,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); } ;; construction.traffic_lights ;; construction.towns_build_traffic_lights diff --git a/src/tbtr_template_gui_create.cpp b/src/tbtr_template_gui_create.cpp index 7905f064f6..c9f117c66c 100644 --- a/src/tbtr_template_gui_create.cpp +++ b/src/tbtr_template_gui_create.cpp @@ -175,7 +175,7 @@ public: /* more cleanup */ *create_window_open = false; - DeleteWindowById(WC_BUILD_VIRTUAL_TRAIN, this->window_number); + CloseWindowById(WC_BUILD_VIRTUAL_TRAIN, this->window_number); InvalidateWindowClassesData(WC_TEMPLATEGUI_MAIN); } diff --git a/src/tbtr_template_gui_main.cpp b/src/tbtr_template_gui_main.cpp index 25879e9a70..710c105efe 100644 --- a/src/tbtr_template_gui_main.cpp +++ b/src/tbtr_template_gui_main.cpp @@ -256,7 +256,7 @@ public: } ~TemplateReplaceWindow() { - DeleteWindowById(WC_CREATE_TEMPLATE, this->window_number); + CloseWindowById(WC_CREATE_TEMPLATE, this->window_number); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index be4337e895..83320e6fe4 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -447,7 +447,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(&_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 b281bb3bba..1348231c80 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -451,7 +451,7 @@ struct TimetableWindow : GeneralVehicleWindow { /* Removed / replaced all orders (after deleting / sharing) */ if (this->sel_index == -1) break; - this->DeleteChildWindows(); + this->CloseChildWindows(); this->sel_index = -1; break; @@ -490,7 +490,7 @@ struct TimetableWindow : GeneralVehicleWindow { /* 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 { @@ -878,7 +878,7 @@ struct TimetableWindow : GeneralVehicleWindow { const Vehicle *v = this->vehicle; this->clicked_widget = widget; - this->DeleteChildWindows(WC_QUERY_STRING); + this->CloseChildWindows(WC_QUERY_STRING); switch (widget) { case WID_VT_ORDER_VIEW: // Order view button @@ -900,7 +900,7 @@ struct TimetableWindow : GeneralVehicleWindow { this->sel_index = (selected == INVALID_ORDER || selected == this->sel_index) ? -1 : selected; } - this->DeleteChildWindows(); + this->CloseChildWindows(); break; } @@ -1248,8 +1248,8 @@ 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(&_timetable_desc, v->index); } diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index dc3860dff1..e4672f595d 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -113,7 +113,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); #ifdef WITH_ASSERT /* Check no industry is related to us. */ diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 6d872e8445..e6dc7b37a2 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -2149,7 +2149,7 @@ static WindowDesc _select_town_desc( static void ShowSelectTownWindow(const TownList &towns, const CommandContainer &cmd) { - DeleteWindowByClass(WC_SELECT_TOWN); + CloseWindowByClass(WC_SELECT_TOWN); new SelectTownWindow(&_select_town_desc, towns, cmd); } @@ -2160,7 +2160,7 @@ static void PlaceProc_House(TileIndex tile) return; } - DeleteWindowById(WC_SELECT_TOWN, 0); + CloseWindowById(WC_SELECT_TOWN, 0); if (_cur_house == INVALID_HOUSE_ID) return; @@ -2210,7 +2210,7 @@ static void PlaceProc_House(TileIndex tile) SB(cmd.p1, 16, 16, towns[0]); // set the town, it's alone on the list DoCommandP(&cmd); } else { - if (!_settings_client.gui.persistent_buildingtools) DeleteWindowById(WC_BUILD_HOUSE, 0); + if (!_settings_client.gui.persistent_buildingtools) CloseWindowById(WC_BUILD_HOUSE, 0); ShowSelectTownWindow(towns, cmd); } } diff --git a/src/tracerestrict.cpp b/src/tracerestrict.cpp index 3b81cf90ab..db664034e4 100644 --- a/src/tracerestrict.cpp +++ b/src/tracerestrict.cpp @@ -1786,7 +1786,7 @@ void TraceRestrictNotifySignalRemoval(TileIndex tile, Track track) { TraceRestrictRefId ref = MakeTraceRestrictRefId(tile, track); bool removed = TraceRestrictRemoveProgramMapping(ref); - DeleteWindowById(WC_TRACE_RESTRICT, ref); + CloseWindowById(WC_TRACE_RESTRICT, ref); if (removed) InvalidateWindowClassesData(WC_TRACE_RESTRICT); } diff --git a/src/tracerestrict_gui.cpp b/src/tracerestrict_gui.cpp index 6ebbf04568..82a1f97c67 100644 --- a/src/tracerestrict_gui.cpp +++ b/src/tracerestrict_gui.cpp @@ -1832,7 +1832,7 @@ public: return; } - this->DeleteChildWindows(); + this->CloseChildWindows(); HideDropDownMenu(this); if (sel == -1 || this->GetOwner() != _local_company) { @@ -3910,7 +3910,7 @@ public: /* Process ID-invalidation in command-scope as well */ if (this->slot_rename != INVALID_TRACE_RESTRICT_SLOT_ID && this->slot_rename != NEW_TRACE_RESTRICT_SLOT_ID && !TraceRestrictSlot::IsValidID(this->slot_rename)) { - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); this->slot_rename = INVALID_TRACE_RESTRICT_SLOT_ID; } @@ -4472,7 +4472,7 @@ public: if (this->ctr_qt_op != INVALID_TRACE_RESTRICT_COUNTER_ID && this->ctr_qt_op != NEW_TRACE_RESTRICT_COUNTER_ID && !TraceRestrictCounter::IsValidID(this->ctr_qt_op)) { - DeleteWindowByClass(WC_QUERY_STRING); + CloseWindowByClass(WC_QUERY_STRING); this->ctr_qt_op = INVALID_TRACE_RESTRICT_COUNTER_ID; } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index e8b891842c..6162a75b79 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2200,12 +2200,12 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u */ if (src == original_src_head && src->IsEngine() && (!src->IsFrontEngine() || new_head)) { /* 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); - DeleteWindowById(WC_SCHDISPATCH_SLOTS, 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); + CloseWindowById(WC_SCHDISPATCH_SLOTS, src->index); DeleteNewGRFInspectWindow(GSF_TRAINS, src->index); SetWindowDirty(WC_COMPANY, _current_company); @@ -7132,14 +7132,14 @@ CommandCost CmdBuildVirtualRailVehicle(TileIndex tile, DoCommandFlag flags, uint void ClearVehicleWindows(const Train *v) { if (v->IsPrimaryVehicle()) { - DeleteWindowById(WC_VEHICLE_VIEW, v->index); - DeleteWindowById(WC_VEHICLE_ORDERS, v->index); - DeleteWindowById(WC_VEHICLE_REFIT, v->index); - DeleteWindowById(WC_VEHICLE_DETAILS, v->index); - DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index); - DeleteWindowById(WC_SCHDISPATCH_SLOTS, v->index); - DeleteWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, v->index); - DeleteWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, v->index); + CloseWindowById(WC_VEHICLE_VIEW, v->index); + CloseWindowById(WC_VEHICLE_ORDERS, v->index); + CloseWindowById(WC_VEHICLE_REFIT, v->index); + CloseWindowById(WC_VEHICLE_DETAILS, v->index); + CloseWindowById(WC_VEHICLE_TIMETABLE, v->index); + CloseWindowById(WC_SCHDISPATCH_SLOTS, v->index); + CloseWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, v->index); + CloseWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, v->index); } } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index ee3eb117cd..ce118ee8e0 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1209,14 +1209,14 @@ 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); - DeleteWindowById(WC_SCHDISPATCH_SLOTS, this->index); - DeleteWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, this->index); - DeleteWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, 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); + CloseWindowById(WC_SCHDISPATCH_SLOTS, this->index); + CloseWindowById(WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS, this->index); + CloseWindowById(WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS, this->index); SetWindowDirty(WC_COMPANY, this->owner); OrderBackup::ClearVehicle(this); } @@ -4211,7 +4211,7 @@ void Vehicle::RemoveFromShared() if (this->orders->GetNumVehicles() == 1 && !_settings_client.gui.enable_single_veh_shared_order_gui) { /* When there is only one vehicle, remove the shared order list window. */ - DeleteWindowById(GetWindowClassForVehicleType(this->type), vli.Pack()); + CloseWindowById(GetWindowClassForVehicleType(this->type), vli.Pack()); } else if (were_first) { /* If we were the first one, update to the new first one. * Note: FirstShared() is already the new first */ diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 1718f5008a..5059e676b9 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1456,7 +1456,7 @@ static WindowDesc _vehicle_refit_desc( */ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit, bool is_virtual_train) { - DeleteWindowById(WC_VEHICLE_REFIT, v->index); + CloseWindowById(WC_VEHICLE_REFIT, v->index); RefitWindow *w = new RefitWindow(&_vehicle_refit_desc, v, order, auto_refit, is_virtual_train); w->parent = parent; } @@ -3431,8 +3431,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((v->type == VEH_TRAIN) ? &_train_vehicle_details_desc : &_nontrain_vehicle_details_desc, v->index); } @@ -3682,10 +3682,10 @@ public: const Vehicle *v = Vehicle::Get(this->window_number); MarkDirtyFocusedRoutePaths(v); } - 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); if (this->fixed_route_overlay_active) { RemoveFixedViewportRoutePath(this->window_number); diff --git a/src/viewport.cpp b/src/viewport.cpp index 7371329c23..180419f0e8 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -5302,7 +5302,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 68992808c3..c92329f981 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -58,7 +58,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); DeleteNewGRFInspectWindow(GSF_FAKE_STATION_STRUCT, this->index); RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index); if (_viewport_sign_kdtree_valid && 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 703531940e..b5f80f989d 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -108,7 +108,7 @@ public: ~WaypointWindow() { - 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); SetViewportCatchmentWaypoint(Waypoint::Get(this->window_number), false); } diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index b3ba152500..9d8cef6958 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -367,7 +367,7 @@ struct DropdownWindow : Window { */ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button, Rect wi_rect, Colours wi_colour, bool instant_close, DropDownSyncFocus sync_parent_focus) { - 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 86014fa0a6..512e713564 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1116,7 +1116,7 @@ static Window *FindChildWindow(const Window *w, WindowClass wc) * Delete 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) { @@ -1150,7 +1150,7 @@ Window::~Window() this->OnFocusLost(nullptr); } - this->DeleteChildWindows(); + this->CloseChildWindows(); if (this->viewport != nullptr) DeleteWindowViewport(this); @@ -1166,7 +1166,7 @@ Window::~Window() * removed from the list of windows to prevent issues with items * being removed during the iteration as not one but more windows * may be removed by a single call to ~Window by means of the - * DeleteChildWindows function. + * CloseChildWindows function. */ const_cast(this->window_class) = WC_INVALID; } @@ -1228,7 +1228,7 @@ Window *GetMainWindow() * @param number Number of the window within the window class * @param force force deletion; if false don't delete 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)) { @@ -1242,7 +1242,7 @@ void DeleteWindowById(WindowClass cls, WindowNumber number, bool force) * @param number Number of the window within the window class * @param force force deletion; if false don't delete when stickied */ -void DeleteAllWindowsById(WindowClass cls, WindowNumber number, bool force) +void CloseAllWindowsById(WindowClass cls, WindowNumber number, bool force) { if (cls < WC_END && !_present_window_types[cls]) return; @@ -1258,7 +1258,7 @@ void DeleteAllWindowsById(WindowClass cls, WindowNumber number, bool force) * Delete all windows of a given class * @param cls Window class of windows to delete */ -void DeleteWindowByClass(WindowClass cls) +void CloseWindowByClass(WindowClass cls) { if (cls < WC_END && !_present_window_types[cls]) return; @@ -1286,7 +1286,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); } /** @@ -2481,7 +2481,7 @@ static void StartWindowDrag(Window *w) _drag_delta.x = w->left - _cursor.pos.x; _drag_delta.y = w->top - _cursor.pos.y; - DeleteWindowById(WC_DROPDOWN_MENU, 0); + CloseWindowById(WC_DROPDOWN_MENU, 0); BringWindowToFront(w); } @@ -2499,7 +2499,7 @@ static void StartWindowSizing(Window *w, bool to_left) _drag_delta.x = _cursor.pos.x; _drag_delta.y = _cursor.pos.y; - DeleteWindowById(WC_DROPDOWN_MENU, 0); + CloseWindowById(WC_DROPDOWN_MENU, 0); BringWindowToFront(w); } @@ -3533,12 +3533,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::IterateUnordered()) { @@ -3557,7 +3557,7 @@ 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() { /* Note: the container remains stable, even when closing windows. */ for (Window *w : Window::IterateUnordered()) { @@ -3575,14 +3575,14 @@ 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 (const Window *w : Window::IterateUnordered()) { @@ -3593,9 +3593,9 @@ void DeleteConstructionWindows() } /** - * Delete all windows that use network client functionality. + * Close all windows that use network client functionality. */ -void DeleteNetworkClientWindows() +void CloseNetworkClientWindows() { /* Note: the container remains stable, even when deleting windows. */ for (const Window *w : Window::IterateUnordered()) { @@ -3608,8 +3608,8 @@ void DeleteNetworkClientWindows() /** Delete 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); } void ReInitWindow(Window *w, bool zoom_changed) @@ -3743,7 +3743,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::IterateFromBack()) { int left, top; diff --git a/src/window_func.h b/src/window_func.h index 27ca5bef2d..770b3137b3 100644 --- a/src/window_func.h +++ b/src/window_func.h @@ -37,18 +37,14 @@ 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 DeleteNetworkClientWindows(); +void CloseConstructionWindows(); +void CloseNetworkClientWindows(); void HideVitalWindows(); void ShowVitalWindows(); -inline void CloseNonVitalWindows() { DeleteNonVitalWindows(); } -inline void CloseAllNonVitalWindows() { DeleteAllNonVitalWindows(); } -inline void CloseConstructionWindows() { DeleteConstructionWindows(); } - /** * Re-initialize all windows. * @param zoom_changed Set if windows are being re-initialized due to a zoom level changed. @@ -59,12 +55,9 @@ 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 DeleteAllWindowsById(WindowClass cls, WindowNumber number, bool force = true); -void DeleteWindowByClass(WindowClass cls); - -inline void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true) { DeleteWindowById(cls, number, force); } -inline void CloseWindowByClass(WindowClass cls) { DeleteWindowByClass(cls); } +void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true); +void CloseAllWindowsById(WindowClass cls, WindowNumber number, bool force = true); +void CloseWindowByClass(WindowClass cls); bool FocusWindowById(WindowClass cls, WindowNumber number); diff --git a/src/window_gui.h b/src/window_gui.h index 498f20bc17..823ddd3f07 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -523,8 +523,7 @@ public: void DrawSortButtonState(int widget, SortButtonState state) const; static int SortButtonWidth(); - void DeleteChildWindows(WindowClass wc = WC_INVALID) const; - inline void CloseChildWindows(WindowClass wc = WC_INVALID) const { this->DeleteChildWindows(wc); } + void CloseChildWindows(WindowClass wc = WC_INVALID) const; void SetDirty(); void SetDirtyAsBlocks();