mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Rename window related DeleteXXX to match new behaviour
This commit is contained in:
parent
994bf19aef
commit
5799402f7a
|
@ -114,7 +114,7 @@
|
||||||
cur_company.Restore();
|
cur_company.Restore();
|
||||||
|
|
||||||
InvalidateWindowData(WC_AI_DEBUG, 0, -1);
|
InvalidateWindowData(WC_AI_DEBUG, 0, -1);
|
||||||
DeleteWindowById(WC_AI_SETTINGS, company);
|
CloseWindowById(WC_AI_SETTINGS, company);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void AI::Pause(CompanyID company)
|
/* static */ void AI::Pause(CompanyID company)
|
||||||
|
|
|
@ -182,7 +182,7 @@ struct AIListWindow : public Window {
|
||||||
}
|
}
|
||||||
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
|
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
|
||||||
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
||||||
DeleteWindowByClass(WC_QUERY_STRING);
|
CloseWindowByClass(WC_QUERY_STRING);
|
||||||
InvalidateWindowClassesData(WC_TEXTFILE);
|
InvalidateWindowClassesData(WC_TEXTFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ static WindowDesc _ai_list_desc(
|
||||||
*/
|
*/
|
||||||
static void ShowAIListWindow(CompanyID slot)
|
static void ShowAIListWindow(CompanyID slot)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_AI_LIST);
|
CloseWindowByClass(WC_AI_LIST);
|
||||||
new AIListWindow(&_ai_list_desc, slot);
|
new AIListWindow(&_ai_list_desc, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ struct AISettingsWindow : public Window {
|
||||||
if (!this->IsEditableItem(config_item)) return;
|
if (!this->IsEditableItem(config_item)) return;
|
||||||
|
|
||||||
if (this->clicked_row != num) {
|
if (this->clicked_row != num) {
|
||||||
DeleteChildWindows(WC_QUERY_STRING);
|
this->CloseChildWindows(WC_QUERY_STRING);
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
this->clicked_row = num;
|
this->clicked_row = num;
|
||||||
this->clicked_dropdown = false;
|
this->clicked_dropdown = false;
|
||||||
|
@ -584,7 +584,7 @@ struct AISettingsWindow : public Window {
|
||||||
{
|
{
|
||||||
this->RebuildVisibleSettings();
|
this->RebuildVisibleSettings();
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
DeleteChildWindows(WC_QUERY_STRING);
|
this->CloseChildWindows(WC_QUERY_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -628,8 +628,8 @@ static WindowDesc _ai_settings_desc(
|
||||||
*/
|
*/
|
||||||
static void ShowAISettingsWindow(CompanyID slot)
|
static void ShowAISettingsWindow(CompanyID slot)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_AI_LIST);
|
CloseWindowByClass(WC_AI_LIST);
|
||||||
DeleteWindowByClass(WC_AI_SETTINGS);
|
CloseWindowByClass(WC_AI_SETTINGS);
|
||||||
new AISettingsWindow(&_ai_settings_desc, slot);
|
new AISettingsWindow(&_ai_settings_desc, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
|
||||||
*/
|
*/
|
||||||
void ShowScriptTextfileWindow(TextfileType file_type, CompanyID slot)
|
void ShowScriptTextfileWindow(TextfileType file_type, CompanyID slot)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_TEXTFILE, file_type);
|
CloseWindowById(WC_TEXTFILE, file_type);
|
||||||
new ScriptTextfileWindow(file_type, slot);
|
new ScriptTextfileWindow(file_type, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,8 +746,8 @@ struct AIConfigWindow : public Window {
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_AI_LIST);
|
CloseWindowByClass(WC_AI_LIST);
|
||||||
DeleteWindowByClass(WC_AI_SETTINGS);
|
CloseWindowByClass(WC_AI_SETTINGS);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,7 +972,7 @@ struct AIConfigWindow : public Window {
|
||||||
/** Open the AI config window. */
|
/** Open the AI config window. */
|
||||||
void ShowAIConfigWindow()
|
void ShowAIConfigWindow()
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GAME_OPTIONS);
|
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||||
new AIConfigWindow();
|
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.
|
this->highlight_row = -1; // The highlight of one AI make little sense for another AI.
|
||||||
|
|
||||||
/* Close AI settings window to prevent confusion */
|
/* Close AI settings window to prevent confusion */
|
||||||
DeleteWindowByClass(WC_AI_SETTINGS);
|
CloseWindowByClass(WC_AI_SETTINGS);
|
||||||
|
|
||||||
this->InvalidateData(-1);
|
this->InvalidateData(-1);
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct BuildAirToolbarWindow : Window {
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
|
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();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ struct BuildAirToolbarWindow : Window {
|
||||||
WID_AT_AIRPORT,
|
WID_AT_AIRPORT,
|
||||||
WIDGET_LIST_END);
|
WIDGET_LIST_END);
|
||||||
if (!can_build) {
|
if (!can_build) {
|
||||||
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
||||||
|
|
||||||
/* Show in the tooltip why this button is disabled. */
|
/* Show in the tooltip why this button is disabled. */
|
||||||
this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
|
this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
|
||||||
|
@ -159,8 +159,8 @@ struct BuildAirToolbarWindow : Window {
|
||||||
|
|
||||||
this->RaiseButtons();
|
this->RaiseButtons();
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HotkeyList hotkeys;
|
static HotkeyList hotkeys;
|
||||||
|
@ -218,7 +218,7 @@ Window *ShowBuildAirToolbar()
|
||||||
{
|
{
|
||||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||||
|
|
||||||
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||||
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
|
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ public:
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -864,7 +864,7 @@ static WindowDesc _replace_vehicle_desc(
|
||||||
*/
|
*/
|
||||||
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
|
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_REPLACE_VEHICLE, vehicletype);
|
CloseWindowById(WC_REPLACE_VEHICLE, vehicletype);
|
||||||
WindowDesc *desc;
|
WindowDesc *desc;
|
||||||
switch (vehicletype) {
|
switch (vehicletype) {
|
||||||
case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break;
|
case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break;
|
||||||
|
|
|
@ -360,7 +360,7 @@ static WindowDesc _build_bridge_desc(
|
||||||
*/
|
*/
|
||||||
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type)
|
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.
|
/* Data type for the bridge.
|
||||||
* Bit 16,15 = transport type,
|
* Bit 16,15 = transport type,
|
||||||
|
|
|
@ -1686,7 +1686,7 @@ void ShowBuildVehicleWindow(TileIndex tile, VehicleType type)
|
||||||
|
|
||||||
assert(IsCompanyBuildableVehicleType(type));
|
assert(IsCompanyBuildableVehicleType(type));
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_VEHICLE, num);
|
CloseWindowById(WC_BUILD_VEHICLE, num);
|
||||||
|
|
||||||
new BuildVehicleWindow(&_build_vehicle_desc, tile, type);
|
new BuildVehicleWindow(&_build_vehicle_desc, tile, type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -415,6 +415,6 @@ static WindowDesc _cheats_desc(
|
||||||
/** Open cheat window. */
|
/** Open cheat window. */
|
||||||
void ShowCheatWindow()
|
void ShowCheatWindow()
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_CHEATS, 0);
|
CloseWindowById(WC_CHEATS, 0);
|
||||||
new CheatWindow(&_cheats_desc);
|
new CheatWindow(&_cheats_desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ Company::~Company()
|
||||||
{
|
{
|
||||||
if (CleaningPool()) return;
|
if (CleaningPool()) return;
|
||||||
|
|
||||||
DeleteCompanyWindows(this->index);
|
CloseCompanyWindows(this->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +115,7 @@ void SetLocalCompany(CompanyID new_company)
|
||||||
_current_company = _local_company = new_company;
|
_current_company = _local_company = new_company;
|
||||||
|
|
||||||
/* Delete any construction windows... */
|
/* Delete any construction windows... */
|
||||||
if (switching_company) DeleteConstructionWindows();
|
if (switching_company) CloseConstructionWindows();
|
||||||
|
|
||||||
/* ... and redraw the whole screen. */
|
/* ... and redraw the whole screen. */
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
|
@ -824,7 +824,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);
|
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);
|
||||||
|
|
||||||
/* Delete multiplayer progress bar */
|
/* 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);
|
Company *c = DoStartupNewCompany(false);
|
||||||
|
|
||||||
|
@ -887,7 +887,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
if (!(flags & DC_EXEC)) return CommandCost();
|
if (!(flags & DC_EXEC)) return CommandCost();
|
||||||
|
|
||||||
/* Delete any open window of the company */
|
/* Delete any open window of the company */
|
||||||
DeleteCompanyWindows(c->index);
|
CloseCompanyWindows(c->index);
|
||||||
CompanyNewsInformation *cni = MallocT<CompanyNewsInformation>(1);
|
CompanyNewsInformation *cni = MallocT<CompanyNewsInformation>(1);
|
||||||
cni->FillData(c);
|
cni->FillData(c);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ void ShowCompanyFinances(CompanyID company);
|
||||||
void ShowCompany(CompanyID company);
|
void ShowCompany(CompanyID company);
|
||||||
|
|
||||||
void InvalidateCompanyWindows(const Company *c);
|
void InvalidateCompanyWindows(const Company *c);
|
||||||
void DeleteCompanyWindows(CompanyID company);
|
void CloseCompanyWindows(CompanyID company);
|
||||||
void DirtyCompanyInfrastructureWindows(CompanyID company);
|
void DirtyCompanyInfrastructureWindows(CompanyID company);
|
||||||
|
|
||||||
#endif /* COMPANY_GUI_H */
|
#endif /* COMPANY_GUI_H */
|
||||||
|
|
|
@ -443,7 +443,7 @@ void IConsoleSwitch()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICONSOLE_OPENED: case ICONSOLE_FULL:
|
case ICONSOLE_OPENED: case ICONSOLE_FULL:
|
||||||
DeleteWindowById(WC_CONSOLE, 0);
|
CloseWindowById(WC_CONSOLE, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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);
|
new SetDateWindow(&_set_date_desc, window_number, parent, initial_date, min_year, max_year, callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,9 @@ Depot::~Depot()
|
||||||
RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
|
RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, this->index);
|
||||||
|
|
||||||
/* Delete the depot-window */
|
/* Delete the depot-window */
|
||||||
DeleteWindowById(WC_VEHICLE_DEPOT, this->xy);
|
CloseWindowById(WC_VEHICLE_DEPOT, this->xy);
|
||||||
|
|
||||||
/* Delete the depot list */
|
/* Delete the depot list */
|
||||||
VehicleType vt = GetDepotVehicleType(this->xy);
|
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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,8 +293,8 @@ struct DepotWindow : Window {
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_BUILD_VEHICLE, this->window_number);
|
CloseWindowById(WC_BUILD_VEHICLE, this->window_number);
|
||||||
DeleteWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false);
|
CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false);
|
||||||
OrderBackup::Reset(this->window_number);
|
OrderBackup::Reset(this->window_number);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct BuildDocksToolbarWindow : Window {
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
|
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();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +124,8 @@ struct BuildDocksToolbarWindow : Window {
|
||||||
WID_DT_BUOY,
|
WID_DT_BUOY,
|
||||||
WIDGET_LIST_END);
|
WIDGET_LIST_END);
|
||||||
if (!can_build) {
|
if (!can_build) {
|
||||||
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_game_mode != GM_EDITOR) {
|
if (_game_mode != GM_EDITOR) {
|
||||||
|
@ -262,10 +262,10 @@ struct BuildDocksToolbarWindow : Window {
|
||||||
|
|
||||||
this->RaiseButtons();
|
this->RaiseButtons();
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlacePresize(Point pt, TileIndex tile_from) override
|
void OnPlacePresize(Point pt, TileIndex tile_from) override
|
||||||
|
@ -359,7 +359,7 @@ Window *ShowBuildDocksToolbar()
|
||||||
{
|
{
|
||||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||||
|
|
||||||
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||||
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
|
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ public:
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1997,7 +1997,7 @@ static void DoAcquireCompany(Company *c)
|
||||||
|
|
||||||
if (c->is_ai) AI::Stop(c->index);
|
if (c->is_ai) AI::Stop(c->index);
|
||||||
|
|
||||||
DeleteCompanyWindows(ci);
|
CloseCompanyWindows(ci);
|
||||||
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
||||||
InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
|
InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
|
||||||
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
|
InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
|
||||||
|
|
|
@ -528,7 +528,7 @@ bool EngineOverrideManager::ResetToCurrentNewGRFConfig()
|
||||||
*/
|
*/
|
||||||
void SetupEngines()
|
void SetupEngines()
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_ENGINE_PREVIEW);
|
CloseWindowByClass(WC_ENGINE_PREVIEW);
|
||||||
_engine_pool.CleanPool();
|
_engine_pool.CleanPool();
|
||||||
|
|
||||||
assert(_engine_mngr.size() >= _engine_mngr.NUM_DEFAULT_ENGINES);
|
assert(_engine_mngr.size() >= _engine_mngr.NUM_DEFAULT_ENGINES);
|
||||||
|
@ -837,7 +837,7 @@ void EnginesDailyLoop()
|
||||||
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) {
|
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) {
|
||||||
if (e->preview_company != INVALID_COMPANY) {
|
if (e->preview_company != INVALID_COMPANY) {
|
||||||
if (!--e->preview_wait) {
|
if (!--e->preview_wait) {
|
||||||
DeleteWindowById(WC_ENGINE_PREVIEW, i);
|
CloseWindowById(WC_ENGINE_PREVIEW, i);
|
||||||
e->preview_company = INVALID_COMPANY;
|
e->preview_company = INVALID_COMPANY;
|
||||||
}
|
}
|
||||||
} else if (CountBits(e->preview_asked) < MAX_COMPANIES) {
|
} 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);
|
if (e->type == VEH_AIRCRAFT) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_AIR);
|
||||||
|
|
||||||
/* Close pending preview windows */
|
/* 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. */
|
/** Monthly update of the availability, reliability, and preview offers of the engines. */
|
||||||
|
|
|
@ -920,7 +920,7 @@ static WindowDesc _save_dialog_desc(
|
||||||
*/
|
*/
|
||||||
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
|
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SAVELOAD, 0);
|
CloseWindowById(WC_SAVELOAD, 0);
|
||||||
|
|
||||||
WindowDesc *sld;
|
WindowDesc *sld;
|
||||||
if (fop == SLO_SAVE) {
|
if (fop == SLO_SAVE) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ static void CleanupGeneration()
|
||||||
_gw.proc = nullptr;
|
_gw.proc = nullptr;
|
||||||
_gw.abortp = nullptr;
|
_gw.abortp = nullptr;
|
||||||
|
|
||||||
DeleteWindowByClass(WC_MODAL_PROGRESS);
|
CloseWindowByClass(WC_MODAL_PROGRESS);
|
||||||
ShowFirstError();
|
ShowFirstError();
|
||||||
MarkWholeScreenDirty();
|
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);
|
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
|
||||||
|
|
||||||
UnshowCriticalError();
|
UnshowCriticalError();
|
||||||
DeleteAllNonVitalWindows();
|
CloseAllNonVitalWindows();
|
||||||
HideVitalWindows();
|
HideVitalWindows();
|
||||||
|
|
||||||
ShowGenerateWorldProgress();
|
ShowGenerateWorldProgress();
|
||||||
|
|
|
@ -285,7 +285,7 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = {
|
||||||
|
|
||||||
static void StartGeneratingLandscape(GenerateLandscapeWindowMode mode)
|
static void StartGeneratingLandscape(GenerateLandscapeWindowMode mode)
|
||||||
{
|
{
|
||||||
DeleteAllNonVitalWindows();
|
CloseAllNonVitalWindows();
|
||||||
ClearErrorMessages();
|
ClearErrorMessages();
|
||||||
|
|
||||||
/* Copy all XXX_newgame to XXX when coming from outside the editor */
|
/* 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 x = 0;
|
||||||
uint y = 0;
|
uint y = 0;
|
||||||
|
|
||||||
DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
|
CloseWindowByClass(WC_GENERATE_LANDSCAPE);
|
||||||
|
|
||||||
/* Generate a new seed when opening the window */
|
/* Generate a new seed when opening the window */
|
||||||
_settings_newgame.game_creation.generation_seed = InteractiveRandom();
|
_settings_newgame.game_creation.generation_seed = InteractiveRandom();
|
||||||
|
@ -1267,7 +1267,7 @@ static WindowDesc _create_scenario_desc(
|
||||||
/** Show the window to create a scenario. */
|
/** Show the window to create a scenario. */
|
||||||
void ShowCreateScenario()
|
void ShowCreateScenario()
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
|
CloseWindowByClass(WC_GENERATE_LANDSCAPE);
|
||||||
new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
|
new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,13 +296,13 @@ CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
|
|
||||||
if (_current_company == OWNER_DEITY) {
|
if (_current_company == OWNER_DEITY) {
|
||||||
/* It has been requested to close this specific question on all clients */
|
/* 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();
|
return CommandCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_networking && _local_company == _current_company) {
|
if (_networking && _local_company == _current_company) {
|
||||||
/* Somebody in the same company answered the question. Close the window */
|
/* 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();
|
if (!_network_server) return CommandCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
VehicleType vt = g->vehicle_type;
|
VehicleType vt = g->vehicle_type;
|
||||||
|
|
||||||
/* Delete the Replace Vehicle Windows */
|
/* Delete the Replace Vehicle Windows */
|
||||||
DeleteWindowById(WC_REPLACE_VEHICLE, g->vehicle_type);
|
CloseWindowById(WC_REPLACE_VEHICLE, g->vehicle_type);
|
||||||
delete g;
|
delete g;
|
||||||
|
|
||||||
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).Pack());
|
InvalidateWindowData(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).Pack());
|
||||||
|
|
|
@ -449,7 +449,7 @@ public:
|
||||||
|
|
||||||
/* Process ID-invalidation in command-scope as well */
|
/* Process ID-invalidation in command-scope as well */
|
||||||
if (this->group_rename != INVALID_GROUP && !Group::IsValidID(this->group_rename)) {
|
if (this->group_rename != INVALID_GROUP && !Group::IsValidID(this->group_rename)) {
|
||||||
DeleteWindowByClass(WC_QUERY_STRING);
|
CloseWindowByClass(WC_QUERY_STRING);
|
||||||
this->group_rename = INVALID_GROUP;
|
this->group_rename = INVALID_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ static WindowDesc _endgame_desc(
|
||||||
*/
|
*/
|
||||||
void ShowHighscoreTable(int difficulty, int8 ranking)
|
void ShowHighscoreTable(int difficulty, int8 ranking)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_HIGHSCORE);
|
CloseWindowByClass(WC_HIGHSCORE);
|
||||||
new HighScoreWindow(&_highscore_desc, difficulty, ranking);
|
new HighScoreWindow(&_highscore_desc, difficulty, ranking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +246,6 @@ void ShowEndGameChart()
|
||||||
if (_network_dedicated || (!_networking && !Company::IsValidID(_local_company))) return;
|
if (_network_dedicated || (!_networking && !Company::IsValidID(_local_company))) return;
|
||||||
|
|
||||||
HideVitalWindows();
|
HideVitalWindows();
|
||||||
DeleteWindowByClass(WC_ENDSCREEN);
|
CloseWindowByClass(WC_ENDSCREEN);
|
||||||
new EndGameWindow(&_endgame_desc);
|
new EndGameWindow(&_endgame_desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ Industry::~Industry()
|
||||||
DecIndustryTypeCount(this->type);
|
DecIndustryTypeCount(this->type);
|
||||||
|
|
||||||
DeleteIndustryNews(this->index);
|
DeleteIndustryNews(this->index);
|
||||||
DeleteWindowById(WC_INDUSTRY_VIEW, this->index);
|
CloseWindowById(WC_INDUSTRY_VIEW, this->index);
|
||||||
DeleteNewGRFInspectWindow(GSF_INDUSTRIES, this->index);
|
DeleteNewGRFInspectWindow(GSF_INDUSTRIES, this->index);
|
||||||
|
|
||||||
DeleteSubsidyWith(ST_INDUSTRY, this->index);
|
DeleteSubsidyWith(ST_INDUSTRY, this->index);
|
||||||
|
|
|
@ -303,8 +303,8 @@ struct MainWindow : Window
|
||||||
}
|
}
|
||||||
|
|
||||||
case GHK_RESET_OBJECT_TO_PLACE: ResetObjectToPlace(); break;
|
case GHK_RESET_OBJECT_TO_PLACE: ResetObjectToPlace(); break;
|
||||||
case GHK_DELETE_WINDOWS: DeleteNonVitalWindows(); break;
|
case GHK_DELETE_WINDOWS: CloseNonVitalWindows(); break;
|
||||||
case GHK_DELETE_NONVITAL_WINDOWS: DeleteAllNonVitalWindows(); break;
|
case GHK_DELETE_NONVITAL_WINDOWS: CloseAllNonVitalWindows(); break;
|
||||||
case GHK_DELETE_ALL_MESSAGES: DeleteAllMessages(); break;
|
case GHK_DELETE_ALL_MESSAGES: DeleteAllMessages(); break;
|
||||||
case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break;
|
case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break;
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void ShowLandInfo(TileIndex tile)
|
void ShowLandInfo(TileIndex tile)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_LAND_INFO, 0);
|
CloseWindowById(WC_LAND_INFO, 0);
|
||||||
new LandInfoWindow(tile);
|
new LandInfoWindow(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ struct AboutWindow : public Window {
|
||||||
|
|
||||||
void ShowAboutWindow()
|
void ShowAboutWindow()
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GAME_OPTIONS);
|
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||||
new AboutWindow();
|
new AboutWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,7 +789,7 @@ struct TooltipsWindow : public Window
|
||||||
*/
|
*/
|
||||||
void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
|
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;
|
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);
|
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);
|
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) {
|
switch (widget) {
|
||||||
case WID_Q_YES: {
|
case WID_Q_YES: {
|
||||||
/* in the Generate New World window, clicking 'Yes' causes
|
/* 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;
|
QueryCallbackProc *proc = this->proc;
|
||||||
Window *parent = this->parent;
|
Window *parent = this->parent;
|
||||||
/* Prevent the destructor calling the callback function */
|
/* Prevent the destructor calling the callback function */
|
||||||
|
|
|
@ -668,7 +668,7 @@ public:
|
||||||
|
|
||||||
void OnFailure() override
|
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);
|
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);
|
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);
|
NetworkClose(close_admins);
|
||||||
|
|
||||||
|
|
|
@ -533,6 +533,6 @@ static WindowDesc _chat_window_desc(
|
||||||
*/
|
*/
|
||||||
void ShowNetworkChatQueryWindow(DestType type, int dest)
|
void ShowNetworkChatQueryWindow(DestType type, int dest)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_SEND_NETWORK_MSG);
|
CloseWindowByClass(WC_SEND_NETWORK_MSG);
|
||||||
new NetworkChatWindow(&_chat_window_desc, type, dest);
|
new NetworkChatWindow(&_chat_window_desc, type, dest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
|
||||||
this->CloseConnection(res);
|
this->CloseConnection(res);
|
||||||
_networking = false;
|
_networking = false;
|
||||||
|
|
||||||
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
|
||||||
{
|
{
|
||||||
/* We try to join a server which is full */
|
/* We try to join a server which is full */
|
||||||
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL);
|
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;
|
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 */
|
/* We try to join a server where we are banned */
|
||||||
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL);
|
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;
|
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 */
|
/* Perform an emergency save if we had already entered the game */
|
||||||
if (this->status == STATUS_ACTIVE) ClientNetworkEmergencySave();
|
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;
|
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();
|
this->last_packet = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
if (!load_success) {
|
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);
|
ShowErrorMessage(STR_NETWORK_ERROR_SAVEGAMEERROR, INVALID_STRING_ID, WL_CRITICAL);
|
||||||
return NETWORK_RECV_STATUS_SAVEGAME;
|
return NETWORK_RECV_STATUS_SAVEGAME;
|
||||||
}
|
}
|
||||||
|
|
|
@ -495,7 +495,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *p)
|
||||||
/* We have a file opened, thus are downloading internal content */
|
/* We have a file opened, thus are downloading internal content */
|
||||||
size_t toRead = p->RemainingBytesToTransfer();
|
size_t toRead = p->RemainingBytesToTransfer();
|
||||||
if (toRead != 0 && (size_t)p->TransferOut(TransferOutFWrite, this->curFile) != toRead) {
|
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);
|
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
|
||||||
this->CloseConnection();
|
this->CloseConnection();
|
||||||
fclose(this->curFile);
|
fclose(this->curFile);
|
||||||
|
@ -529,7 +529,7 @@ bool ClientNetworkContentSocketHandler::BeforeDownload()
|
||||||
std::string filename = GetFullFilename(this->curInfo, true);
|
std::string filename = GetFullFilename(this->curInfo, true);
|
||||||
if (filename.empty() || (this->curFile = fopen(filename.c_str(), "wb")) == nullptr) {
|
if (filename.empty() || (this->curFile = fopen(filename.c_str(), "wb")) == nullptr) {
|
||||||
/* Unless that fails of course... */
|
/* 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);
|
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct ContentTextfileWindow : public TextfileWindow {
|
||||||
|
|
||||||
void ShowContentTextfileWindow(TextfileType file_type, const ContentInfo *ci)
|
void ShowContentTextfileWindow(TextfileType file_type, const ContentInfo *ci)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_TEXTFILE, file_type);
|
CloseWindowById(WC_TEXTFILE, file_type);
|
||||||
new ContentTextfileWindow(file_type, ci);
|
new ContentTextfileWindow(file_type, ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ public:
|
||||||
} else {
|
} else {
|
||||||
/* If downloading succeeded, close the online content window. This will close
|
/* If downloading succeeded, close the online content window. This will close
|
||||||
* the current window as well. */
|
* 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);
|
_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);
|
new NetworkContentListWindow(&_network_content_list_desc, cv != nullptr, types);
|
||||||
#else
|
#else
|
||||||
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);
|
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);
|
||||||
|
|
|
@ -677,7 +677,7 @@ public:
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_NG_CANCEL: // Cancel button
|
case WID_NG_CANCEL: // Cancel button
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_NG_NAME: // Sort by name
|
case WID_NG_NAME: // Sort by name
|
||||||
|
@ -966,8 +966,8 @@ static WindowDesc _network_game_window_desc(
|
||||||
void ShowNetworkGameWindow()
|
void ShowNetworkGameWindow()
|
||||||
{
|
{
|
||||||
static bool first = true;
|
static bool first = true;
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
|
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
||||||
|
|
||||||
/* Only show once */
|
/* Only show once */
|
||||||
if (first) {
|
if (first) {
|
||||||
|
@ -1265,8 +1265,8 @@ static void ShowNetworkStartServerWindow()
|
||||||
{
|
{
|
||||||
if (!NetworkValidateClientName()) return;
|
if (!NetworkValidateClientName()) return;
|
||||||
|
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
|
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
|
||||||
|
|
||||||
new NetworkStartServerWindow(&_network_start_server_window_desc);
|
new NetworkStartServerWindow(&_network_start_server_window_desc);
|
||||||
}
|
}
|
||||||
|
@ -1559,8 +1559,8 @@ static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
|
||||||
{
|
{
|
||||||
if (!NetworkValidateClientName()) return;
|
if (!NetworkValidateClientName()) return;
|
||||||
|
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
|
||||||
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
|
||||||
|
|
||||||
_settings_client.network.last_joined = ngl->connection_string;
|
_settings_client.network.last_joined = ngl->connection_string;
|
||||||
|
|
||||||
|
@ -2519,7 +2519,7 @@ static WindowDesc _network_join_status_window_desc(
|
||||||
|
|
||||||
void ShowJoinStatusWindow()
|
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);
|
new NetworkJoinStatusWindow(&_network_join_status_window_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2642,7 +2642,7 @@ static WindowDesc _network_company_password_window_desc(
|
||||||
|
|
||||||
void ShowNetworkCompanyPasswordWindow(Window *parent)
|
void ShowNetworkCompanyPasswordWindow(Window *parent)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_COMPANY_PASSWORD_WINDOW, 0);
|
CloseWindowById(WC_COMPANY_PASSWORD_WINDOW, 0);
|
||||||
|
|
||||||
new NetworkCompanyPasswordWindow(&_network_company_password_window_desc, parent);
|
new NetworkCompanyPasswordWindow(&_network_company_password_window_desc, parent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -706,7 +706,7 @@ void DoScanNewGRFFiles(NewGRFScanCallback *callback)
|
||||||
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE, GOID_NEWGRF_RESCANNED, true);
|
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE, GOID_NEWGRF_RESCANNED, true);
|
||||||
if (!_exit_game && callback != nullptr) callback->OnNewGRFsScanned();
|
if (!_exit_game && callback != nullptr) callback->OnNewGRFsScanned();
|
||||||
|
|
||||||
DeleteWindowByClass(WC_MODAL_PROGRESS);
|
CloseWindowByClass(WC_MODAL_PROGRESS);
|
||||||
SetModalProgress(false);
|
SetModalProgress(false);
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -736,7 +736,7 @@ void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
|
||||||
if (feature == GSF_INVALID) return;
|
if (feature == GSF_INVALID) return;
|
||||||
|
|
||||||
WindowNumber wno = GetInspectWindowNumber(feature, index);
|
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.
|
/* 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
|
* Note: Since we might be called from a command here, it is important to not execute
|
||||||
|
|
|
@ -341,7 +341,7 @@ struct NewGRFParametersWindow : public Window {
|
||||||
uint num = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NP_BACKGROUND);
|
uint num = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NP_BACKGROUND);
|
||||||
if (num >= this->vscroll->GetCount()) break;
|
if (num >= this->vscroll->GetCount()) break;
|
||||||
if (this->clicked_row != num) {
|
if (this->clicked_row != num) {
|
||||||
DeleteChildWindows(WC_QUERY_STRING);
|
this->CloseChildWindows(WC_QUERY_STRING);
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
this->clicked_row = num;
|
this->clicked_row = num;
|
||||||
this->clicked_dropdown = false;
|
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);
|
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()) {
|
if (this->clicked_row != UINT_MAX && this->clicked_row >= this->vscroll->GetCount()) {
|
||||||
this->clicked_row = UINT_MAX;
|
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)
|
static void OpenGRFParameterWindow(GRFConfig *c, bool editable)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
new NewGRFParametersWindow(&_newgrf_parameters_desc, c, editable);
|
new NewGRFParametersWindow(&_newgrf_parameters_desc, c, editable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ struct NewGRFTextfileWindow : public TextfileWindow {
|
||||||
|
|
||||||
void ShowNewGRFTextfileWindow(TextfileType file_type, const GRFConfig *c)
|
void ShowNewGRFTextfileWindow(TextfileType file_type, const GRFConfig *c)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_TEXTFILE, file_type);
|
CloseWindowById(WC_TEXTFILE, file_type);
|
||||||
new NewGRFTextfileWindow(file_type, c);
|
new NewGRFTextfileWindow(file_type, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,9 +664,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
DeleteWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
DeleteWindowByClass(WC_SAVE_PRESET);
|
CloseWindowByClass(WC_SAVE_PRESET);
|
||||||
|
|
||||||
if (this->editable && this->modified && !this->execute && !_exit_game) {
|
if (this->editable && this->modified && !this->execute && !_exit_game) {
|
||||||
CopyGRFConfigList(this->orig_list, this->actives, true);
|
CopyGRFConfigList(this->orig_list, this->actives, true);
|
||||||
|
@ -715,8 +715,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
d->next = (*c)->next;
|
d->next = (*c)->next;
|
||||||
d->CopyParams(**c);
|
d->CopyParams(**c);
|
||||||
if (this->active_sel == *c) {
|
if (this->active_sel == *c) {
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
DeleteWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
this->active_sel = nullptr;
|
this->active_sel = nullptr;
|
||||||
}
|
}
|
||||||
delete *c;
|
delete *c;
|
||||||
|
@ -938,7 +938,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
list.emplace_back(new DropDownListCharStringItem(this->grf_presets[i], i, false));
|
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);
|
ShowDropDownList(this, std::move(list), this->preset, WID_NS_PRESET_LIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -962,7 +962,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
this->grf_presets = GetGRFPresetList();
|
this->grf_presets = GetGRFPresetList();
|
||||||
this->preset = -1;
|
this->preset = -1;
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_NS_MOVE_UP: { // Move GRF up
|
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--) {}
|
for (c = this->actives; c != nullptr && i > 0; c = c->next, i--) {}
|
||||||
|
|
||||||
if (this->active_sel != c) {
|
if (this->active_sel != c) {
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
DeleteWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
}
|
}
|
||||||
this->active_sel = c;
|
this->active_sel = c;
|
||||||
this->avail_sel = nullptr;
|
this->avail_sel = nullptr;
|
||||||
|
@ -1030,8 +1030,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
|
|
||||||
case WID_NS_REMOVE: { // Remove GRF
|
case WID_NS_REMOVE: { // Remove GRF
|
||||||
if (this->active_sel == nullptr || !this->editable) break;
|
if (this->active_sel == nullptr || !this->editable) break;
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
DeleteWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
|
|
||||||
/* Choose the next GRF file to be the selected file. */
|
/* Choose the next GRF file to be the selected file. */
|
||||||
GRFConfig *newsel = this->active_sel->next;
|
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);
|
uint i = this->vscroll2->GetScrolledRowFromWidget(pt.y, this, WID_NS_AVAIL_LIST);
|
||||||
this->active_sel = nullptr;
|
this->active_sel = nullptr;
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
if (i < this->avails.size()) {
|
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_sel = this->avails[i];
|
||||||
this->avail_pos = i;
|
this->avail_pos = i;
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1107,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
ReloadNewGRFData();
|
ReloadNewGRFData();
|
||||||
this->InvalidateData(GOID_NEWGRF_CHANGES_APPLIED);
|
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;
|
break;
|
||||||
|
|
||||||
case WID_NS_VIEW_PARAMETERS:
|
case WID_NS_VIEW_PARAMETERS:
|
||||||
|
@ -1132,7 +1132,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
if (!_network_available) {
|
if (!_network_available) {
|
||||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||||
} else {
|
} else {
|
||||||
this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||||
|
|
||||||
ShowMissingContentWindow(this->actives);
|
ShowMissingContentWindow(this->actives);
|
||||||
}
|
}
|
||||||
|
@ -1147,11 +1147,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
|
|
||||||
void OnNewGRFsScanned() override
|
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_sel = nullptr;
|
||||||
this->avail_pos = -1;
|
this->avail_pos = -1;
|
||||||
this->avails.ForceRebuild();
|
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
|
void OnDropdownSelect(int widget, int index) override
|
||||||
|
@ -1167,8 +1167,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
this->avails.ForceRebuild();
|
this->avails.ForceRebuild();
|
||||||
|
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
DeleteWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
this->active_sel = nullptr;
|
this->active_sel = nullptr;
|
||||||
this->InvalidateData(GOID_NEWGRF_CHANGES_MADE);
|
this->InvalidateData(GOID_NEWGRF_CHANGES_MADE);
|
||||||
}
|
}
|
||||||
|
@ -1331,8 +1331,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
|
|
||||||
if (this->avail_pos >= 0) {
|
if (this->avail_pos >= 0) {
|
||||||
this->active_sel = nullptr;
|
this->active_sel = nullptr;
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
if (this->avail_sel != this->avails[this->avail_pos]) DeleteWindowByClass(WC_TEXTFILE);
|
if (this->avail_sel != this->avails[this->avail_pos]) CloseWindowByClass(WC_TEXTFILE);
|
||||||
this->avail_sel = this->avails[this->avail_pos];
|
this->avail_sel = this->avails[this->avail_pos];
|
||||||
this->vscroll2->ScrollTowards(this->avail_pos);
|
this->vscroll2->ScrollTowards(this->avail_pos);
|
||||||
this->InvalidateData(0);
|
this->InvalidateData(0);
|
||||||
|
@ -1497,7 +1497,7 @@ private:
|
||||||
{
|
{
|
||||||
if (this->avail_sel == nullptr || !this->editable || HasBit(this->avail_sel->flags, GCF_INVALID)) return false;
|
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;
|
uint count = 0;
|
||||||
GRFConfig **entry = nullptr;
|
GRFConfig **entry = nullptr;
|
||||||
|
@ -1955,8 +1955,8 @@ static WindowDesc _newgrf_desc(
|
||||||
static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
||||||
{
|
{
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
DeleteWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
NewGRFWindow *nw = dynamic_cast<NewGRFWindow*>(w);
|
NewGRFWindow *nw = dynamic_cast<NewGRFWindow*>(w);
|
||||||
|
|
||||||
GamelogStartAction(GLAT_GRF);
|
GamelogStartAction(GLAT_GRF);
|
||||||
|
@ -1978,7 +1978,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed)
|
||||||
w->InvalidateData();
|
w->InvalidateData();
|
||||||
|
|
||||||
ReInitAllWindows(false);
|
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)
|
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);
|
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)
|
static void ShowSavePresetWindow(const char *initial_text)
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_SAVE_PRESET);
|
CloseWindowByClass(WC_SAVE_PRESET);
|
||||||
new SavePresetWindow(initial_text);
|
new SavePresetWindow(initial_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -699,7 +699,7 @@ static void MoveToNextNewsItem()
|
||||||
* there is no status bar but possible news. */
|
* there is no status bar but possible news. */
|
||||||
if (FindWindowById(WC_STATUS_BAR, 0) == nullptr) return;
|
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;
|
_forced_news = nullptr;
|
||||||
|
|
||||||
/* if we're not at the last item, then move on */
|
/* 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);
|
assert(_total_news != 0);
|
||||||
|
|
||||||
/* Delete the news window */
|
/* Delete the news window */
|
||||||
DeleteWindowById(WC_NEWS_WINDOW, 0);
|
CloseWindowById(WC_NEWS_WINDOW, 0);
|
||||||
|
|
||||||
/* setup forced news item */
|
/* setup forced news item */
|
||||||
_forced_news = ni;
|
_forced_news = ni;
|
||||||
|
|
||||||
if (_forced_news != nullptr) {
|
if (_forced_news != nullptr) {
|
||||||
DeleteWindowById(WC_NEWS_WINDOW, 0);
|
CloseWindowById(WC_NEWS_WINDOW, 0);
|
||||||
ShowNewspaper(ni);
|
ShowNewspaper(ni);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,6 +1251,6 @@ static WindowDesc _message_history_desc(
|
||||||
/** Display window with news messages history */
|
/** Display window with news messages history */
|
||||||
void ShowMessageHistory()
|
void ShowMessageHistory()
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_MESSAGE_HISTORY, 0);
|
CloseWindowById(WC_MESSAGE_HISTORY, 0);
|
||||||
new MessageHistoryWindow(&_message_history_desc);
|
new MessageHistoryWindow(&_message_history_desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1086,13 +1086,13 @@ void SwitchToMode(SwitchMode new_mode)
|
||||||
SetDParamStr(0, GetSaveLoadErrorString());
|
SetDParamStr(0, GetSaveLoadErrorString());
|
||||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
|
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
|
||||||
} else {
|
} else {
|
||||||
DeleteWindowById(WC_SAVELOAD, 0);
|
CloseWindowById(WC_SAVELOAD, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SM_SAVE_HEIGHTMAP: // Save heightmap.
|
case SM_SAVE_HEIGHTMAP: // Save heightmap.
|
||||||
MakeHeightmapScreenshot(_file_to_saveload.name.c_str());
|
MakeHeightmapScreenshot(_file_to_saveload.name.c_str());
|
||||||
DeleteWindowById(WC_SAVELOAD, 0);
|
CloseWindowById(WC_SAVELOAD, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SM_GENRANDLAND: // Generate random land within scenario editor
|
case SM_GENRANDLAND: // Generate random land within scenario editor
|
||||||
|
|
|
@ -843,7 +843,7 @@ public:
|
||||||
/* Removed / replaced all orders (after deleting / sharing) */
|
/* Removed / replaced all orders (after deleting / sharing) */
|
||||||
if (this->selected_order == -1) break;
|
if (this->selected_order == -1) break;
|
||||||
|
|
||||||
this->DeleteChildWindows();
|
this->CloseChildWindows();
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
this->selected_order = -1;
|
this->selected_order = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -875,7 +875,7 @@ public:
|
||||||
/* Now we are modifying the selected order */
|
/* Now we are modifying the selected order */
|
||||||
if (to == INVALID_VEH_ORDER_ID) {
|
if (to == INVALID_VEH_ORDER_ID) {
|
||||||
/* Deleting selected order */
|
/* Deleting selected order */
|
||||||
this->DeleteChildWindows();
|
this->CloseChildWindows();
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
this->selected_order = -1;
|
this->selected_order = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -1174,7 +1174,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This order won't be selected any more, close all child windows and dropdowns */
|
/* This order won't be selected any more, close all child windows and dropdowns */
|
||||||
this->DeleteChildWindows();
|
this->CloseChildWindows();
|
||||||
HideDropDownMenu(this);
|
HideDropDownMenu(this);
|
||||||
|
|
||||||
if (sel == INVALID_VEH_ORDER_ID || this->vehicle->owner != _local_company) {
|
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)
|
void ShowOrdersWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
CloseWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
||||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
|
CloseWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
|
||||||
if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != nullptr) return;
|
if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != nullptr) return;
|
||||||
|
|
||||||
/* Using a different WindowDescs for _local_company causes problems.
|
/* 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
|
* because we cannot change switch the WindowDescs and keeping the old WindowDesc results
|
||||||
* in crashed due to missing widges.
|
* in crashed due to missing widges.
|
||||||
* TODO Rewrite the order GUI to not use different WindowDescs.
|
* TODO Rewrite the order GUI to not use different WindowDescs.
|
||||||
|
|
|
@ -407,7 +407,7 @@ void GetKeyboardLayout()
|
||||||
*/
|
*/
|
||||||
void ShowOnScreenKeyboard(Window *parent, int button)
|
void ShowOnScreenKeyboard(Window *parent, int button)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_OSK, 0);
|
CloseWindowById(WC_OSK, 0);
|
||||||
|
|
||||||
GetKeyboardLayout();
|
GetKeyboardLayout();
|
||||||
new OskWindow(&_osk_desc, parent, button);
|
new OskWindow(&_osk_desc, parent, button);
|
||||||
|
|
|
@ -291,7 +291,7 @@ void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uin
|
||||||
*/
|
*/
|
||||||
static void ToggleRailButton_Remove(Window *w)
|
static void ToggleRailButton_Remove(Window *w)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
w->ToggleWidgetLoweredState(WID_RAT_REMOVE);
|
w->ToggleWidgetLoweredState(WID_RAT_REMOVE);
|
||||||
w->SetWidgetDirty(WID_RAT_REMOVE);
|
w->SetWidgetDirty(WID_RAT_REMOVE);
|
||||||
_remove_button_clicked = w->IsWidgetLowered(WID_RAT_REMOVE);
|
_remove_button_clicked = w->IsWidgetLowered(WID_RAT_REMOVE);
|
||||||
|
@ -437,7 +437,7 @@ struct BuildRailToolbarWindow : Window {
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) SetViewportCatchmentStation(nullptr, true);
|
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();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,12 +743,12 @@ struct BuildRailToolbarWindow : Window {
|
||||||
this->DisableWidget(WID_RAT_REMOVE);
|
this->DisableWidget(WID_RAT_REMOVE);
|
||||||
this->SetWidgetDirty(WID_RAT_REMOVE);
|
this->SetWidgetDirty(WID_RAT_REMOVE);
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
|
CloseWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
|
||||||
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
|
CloseWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
|
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
|
||||||
DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
|
CloseWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlacePresize(Point pt, TileIndex tile) override
|
void OnPlacePresize(Point pt, TileIndex tile) override
|
||||||
|
@ -865,7 +865,7 @@ Window *ShowBuildRailToolbar(RailType railtype)
|
||||||
if (!Company::IsValidID(_local_company)) return nullptr;
|
if (!Company::IsValidID(_local_company)) return nullptr;
|
||||||
if (!ValParamRailtype(railtype)) return nullptr;
|
if (!ValParamRailtype(railtype)) return nullptr;
|
||||||
|
|
||||||
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||||
_cur_railtype = railtype;
|
_cur_railtype = railtype;
|
||||||
_remove_button_clicked = false;
|
_remove_button_clicked = false;
|
||||||
return new BuildRailToolbarWindow(&_build_rail_desc, railtype);
|
return new BuildRailToolbarWindow(&_build_rail_desc, railtype);
|
||||||
|
@ -1031,7 +1031,7 @@ public:
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1347,7 +1347,7 @@ public:
|
||||||
this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X);
|
this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X);
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_BRAS_PLATFORM_NUM_1:
|
case WID_BRAS_PLATFORM_NUM_1:
|
||||||
|
@ -1381,7 +1381,7 @@ public:
|
||||||
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
|
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1416,7 +1416,7 @@ public:
|
||||||
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
|
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1450,7 +1450,7 @@ public:
|
||||||
this->SetWidgetLoweredState(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN, !_settings_client.gui.station_dragdrop);
|
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);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1483,7 +1483,7 @@ public:
|
||||||
}
|
}
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1502,7 +1502,7 @@ public:
|
||||||
|
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,7 +292,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
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_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();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,9 +313,9 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
WID_ROT_TRUCK_STATION,
|
WID_ROT_TRUCK_STATION,
|
||||||
WIDGET_LIST_END);
|
WIDGET_LIST_END);
|
||||||
if (!can_build) {
|
if (!can_build) {
|
||||||
DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_game_mode != GM_EDITOR) {
|
if (_game_mode != GM_EDITOR) {
|
||||||
|
@ -499,7 +499,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
case WID_ROT_REMOVE:
|
case WID_ROT_REMOVE:
|
||||||
if (this->IsWidgetDisabled(WID_ROT_REMOVE)) return;
|
if (this->IsWidgetDisabled(WID_ROT_REMOVE)) return;
|
||||||
|
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
ToggleRoadButton_Remove(this);
|
ToggleRoadButton_Remove(this);
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
break;
|
break;
|
||||||
|
@ -592,11 +592,11 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
this->SetWidgetDirty(WID_ROT_ONE_WAY);
|
this->SetWidgetDirty(WID_ROT_ONE_WAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
CloseWindowByClass(WC_BUILD_BRIDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
|
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 (!Company::IsValidID(_local_company)) return nullptr;
|
||||||
if (!ValParamRoadType(roadtype)) return nullptr;
|
if (!ValParamRoadType(roadtype)) return nullptr;
|
||||||
|
|
||||||
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||||
_cur_roadtype = roadtype;
|
_cur_roadtype = roadtype;
|
||||||
|
|
||||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD);
|
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)
|
Window *ShowBuildRoadScenToolbar(RoadType roadtype)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SCEN_BUILD_TOOLBAR, TRANSPORT_ROAD);
|
CloseWindowById(WC_SCEN_BUILD_TOOLBAR, TRANSPORT_ROAD);
|
||||||
_cur_roadtype = roadtype;
|
_cur_roadtype = roadtype;
|
||||||
|
|
||||||
return AllocateWindowDescFront<BuildRoadToolbarWindow>(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_scen_desc : &_build_tramway_scen_desc, TRANSPORT_ROAD);
|
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
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1159,7 +1159,7 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||||
this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
|
this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_BROS_LT_OFF:
|
case WID_BROS_LT_OFF:
|
||||||
|
|
|
@ -69,6 +69,6 @@ static WindowDesc _screenshot_window_desc(
|
||||||
|
|
||||||
void ShowScreenshotWindow()
|
void ShowScreenshotWindow()
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SCREENSHOT, 0);
|
CloseWindowById(WC_SCREENSHOT, 0);
|
||||||
new ScreenshotWindow(&_screenshot_window_desc);
|
new ScreenshotWindow(&_screenshot_window_desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
if (ScriptGame::IsMultiplayer()) return;
|
if (ScriptGame::IsMultiplayer()) return;
|
||||||
|
|
||||||
if (number == NUMBER_ALL) {
|
if (number == NUMBER_ALL) {
|
||||||
DeleteWindowByClass((::WindowClass)window);
|
CloseWindowByClass((::WindowClass)window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteWindowById((::WindowClass)window, number);
|
CloseWindowById((::WindowClass)window, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool ScriptWindow::IsOpen(WindowClass window, uint32 number)
|
/* static */ bool ScriptWindow::IsOpen(WindowClass window, uint32 number)
|
||||||
|
|
|
@ -842,7 +842,7 @@ static void StationSpreadChanged(int32 p1)
|
||||||
static void CloseSignalGUI(int32 new_value)
|
static void CloseSignalGUI(int32 new_value)
|
||||||
{
|
{
|
||||||
if (new_value == 0) {
|
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)
|
static void TownFoundingChanged(int32 new_value)
|
||||||
{
|
{
|
||||||
if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {
|
if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {
|
||||||
DeleteWindowById(WC_FOUND_TOWN, 0);
|
CloseWindowById(WC_FOUND_TOWN, 0);
|
||||||
} else {
|
} else {
|
||||||
InvalidateWindowData(WC_FOUND_TOWN, 0);
|
InvalidateWindowData(WC_FOUND_TOWN, 0);
|
||||||
}
|
}
|
||||||
|
@ -1015,7 +1015,7 @@ static void SpriteZoomMinChanged(int32 new_value)
|
||||||
static void InvalidateNewGRFChangeWindows(int32 new_value)
|
static void InvalidateNewGRFChangeWindows(int32 new_value)
|
||||||
{
|
{
|
||||||
InvalidateWindowClassesData(WC_SAVELOAD);
|
InvalidateWindowClassesData(WC_SAVELOAD);
|
||||||
DeleteWindowByClass(WC_GAME_OPTIONS);
|
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||||
ReInitAllWindows(_gui_zoom_cfg);
|
ReInitAllWindows(_gui_zoom_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ struct BaseSetTextfileWindow : public TextfileWindow {
|
||||||
template <class TBaseSet>
|
template <class TBaseSet>
|
||||||
void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type)
|
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);
|
new BaseSetTextfileWindow<TBaseSet>(file_type, baseset, content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,8 +174,8 @@ struct GameOptionsWindow : Window {
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_CUSTOM_CURRENCY, 0);
|
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
|
||||||
DeleteWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
if (this->reload) _switch_mode = SM_MENU;
|
if (this->reload) _switch_mode = SM_MENU;
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ struct GameOptionsWindow : Window {
|
||||||
|
|
||||||
case WID_GO_LANG_DROPDOWN: // Change interface language
|
case WID_GO_LANG_DROPDOWN: // Change interface language
|
||||||
ReadLanguagePack(&_languages[index]);
|
ReadLanguagePack(&_languages[index]);
|
||||||
DeleteWindowByClass(WC_QUERY_STRING);
|
CloseWindowByClass(WC_QUERY_STRING);
|
||||||
CheckForMissingGlyphs();
|
CheckForMissingGlyphs();
|
||||||
ClearAllCachedNames();
|
ClearAllCachedNames();
|
||||||
UpdateAllVirtCoords();
|
UpdateAllVirtCoords();
|
||||||
|
@ -744,7 +744,7 @@ static WindowDesc _game_options_desc(
|
||||||
/** Open the game options window. */
|
/** Open the game options window. */
|
||||||
void ShowGameOptions()
|
void ShowGameOptions()
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GAME_OPTIONS);
|
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||||
new GameOptionsWindow(&_game_options_desc);
|
new GameOptionsWindow(&_game_options_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2479,7 +2479,7 @@ static WindowDesc _settings_selection_desc(
|
||||||
/** Open advanced settings window. */
|
/** Open advanced settings window. */
|
||||||
void ShowGameSettings()
|
void ShowGameSettings()
|
||||||
{
|
{
|
||||||
DeleteWindowByClass(WC_GAME_OPTIONS);
|
CloseWindowByClass(WC_GAME_OPTIONS);
|
||||||
new GameSettingsWindow(&_settings_selection_desc);
|
new GameSettingsWindow(&_settings_selection_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2771,6 +2771,6 @@ static WindowDesc _cust_currency_desc(
|
||||||
/** Open custom currency window. */
|
/** Open custom currency window. */
|
||||||
static void ShowCustCurrency()
|
static void ShowCustCurrency()
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_CUSTOM_CURRENCY, 0);
|
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
|
||||||
new CustomCurrencyWindow(&_cust_currency_desc);
|
new CustomCurrencyWindow(&_cust_currency_desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -579,7 +579,7 @@ void HandleClickOnSign(const Sign *si)
|
||||||
void ShowRenameSignWindow(const Sign *si)
|
void ShowRenameSignWindow(const Sign *si)
|
||||||
{
|
{
|
||||||
/* Delete all other edit windows */
|
/* Delete all other edit windows */
|
||||||
DeleteWindowByClass(WC_QUERY_STRING);
|
CloseWindowByClass(WC_QUERY_STRING);
|
||||||
|
|
||||||
new SignWindow(&_query_sign_edit_desc, si);
|
new SignWindow(&_query_sign_edit_desc, si);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,10 @@ BaseStation::~BaseStation()
|
||||||
|
|
||||||
if (CleaningPool()) return;
|
if (CleaningPool()) return;
|
||||||
|
|
||||||
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).Pack());
|
CloseWindowById(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());
|
CloseWindowById(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());
|
CloseWindowById(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_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack());
|
||||||
|
|
||||||
this->sign.MarkDirty();
|
this->sign.MarkDirty();
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ Station::~Station()
|
||||||
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
|
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 */
|
/* Now delete all orders that go to the station */
|
||||||
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
|
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
|
||||||
|
|
|
@ -2396,7 +2396,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
||||||
for (uint i = 0; i < st->airport.GetNumHangars(); ++i) {
|
for (uint i = 0; i < st->airport.GetNumHangars(); ++i) {
|
||||||
TileIndex tile_cur = st->airport.GetHangarTile(i);
|
TileIndex tile_cur = st->airport.GetHangarTile(i);
|
||||||
OrderBackup::Reset(tile_cur, false);
|
OrderBackup::Reset(tile_cur, false);
|
||||||
DeleteWindowById(WC_VEHICLE_DEPOT, tile_cur);
|
CloseWindowById(WC_VEHICLE_DEPOT, tile_cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
const AirportSpec *as = st->airport.GetSpec();
|
const AirportSpec *as = st->airport.GetSpec();
|
||||||
|
|
|
@ -1336,10 +1336,10 @@ struct StationViewWindow : public Window {
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false);
|
CloseWindowById(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);
|
CloseWindowById(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);
|
CloseWindowById(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_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->window_number).Pack(), false);
|
||||||
|
|
||||||
SetViewportCatchmentStation(Station::Get(this->window_number), false);
|
SetViewportCatchmentStation(Station::Get(this->window_number), false);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -2353,7 +2353,7 @@ struct SelectStationWindow : Window {
|
||||||
DoCommandP(&this->select_station_cmd);
|
DoCommandP(&this->select_station_cmd);
|
||||||
|
|
||||||
/* Close Window; this might cause double frees! */
|
/* Close Window; this might cause double frees! */
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnRealtimeTick(uint delta_ms) override
|
void OnRealtimeTick(uint delta_ms) override
|
||||||
|
|
|
@ -1218,7 +1218,7 @@ from = SLV_106
|
||||||
def = true
|
def = true
|
||||||
str = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS
|
str = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS
|
||||||
strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT
|
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]
|
[SDT_BOOL]
|
||||||
|
|
|
@ -364,7 +364,7 @@ Window *ShowTerraformToolbar(Window *link)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete the terraform toolbar to place it again. */
|
/* 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);
|
w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
|
||||||
/* Align the terraform toolbar under the main toolbar. */
|
/* Align the terraform toolbar under the main toolbar. */
|
||||||
w->top -= w->height;
|
w->top -= w->height;
|
||||||
|
|
|
@ -237,7 +237,7 @@ struct TimetableWindow : Window {
|
||||||
/* Removed / replaced all orders (after deleting / sharing) */
|
/* Removed / replaced all orders (after deleting / sharing) */
|
||||||
if (this->sel_index == -1) break;
|
if (this->sel_index == -1) break;
|
||||||
|
|
||||||
this->DeleteChildWindows();
|
this->CloseChildWindows();
|
||||||
this->sel_index = -1;
|
this->sel_index = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ struct TimetableWindow : Window {
|
||||||
/* Now we are modifying the selected order */
|
/* Now we are modifying the selected order */
|
||||||
if (to == INVALID_VEH_ORDER_ID) {
|
if (to == INVALID_VEH_ORDER_ID) {
|
||||||
/* Deleting selected order */
|
/* Deleting selected order */
|
||||||
this->DeleteChildWindows();
|
this->CloseChildWindows();
|
||||||
this->sel_index = -1;
|
this->sel_index = -1;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -523,7 +523,7 @@ struct TimetableWindow : Window {
|
||||||
case WID_VT_TIMETABLE_PANEL: { // Main panel.
|
case WID_VT_TIMETABLE_PANEL: { // Main panel.
|
||||||
int selected = GetOrderFromTimetableWndPt(pt.y, v);
|
int selected = GetOrderFromTimetableWndPt(pt.y, v);
|
||||||
|
|
||||||
this->DeleteChildWindows();
|
this->CloseChildWindows();
|
||||||
this->sel_index = (selected == INVALID_ORDER || selected == this->sel_index) ? -1 : selected;
|
this->sel_index = (selected == INVALID_ORDER || selected == this->sel_index) ? -1 : selected;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -707,7 +707,7 @@ static WindowDesc _timetable_desc(
|
||||||
*/
|
*/
|
||||||
void ShowTimetableWindow(const Vehicle *v)
|
void ShowTimetableWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
CloseWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
||||||
DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
CloseWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
||||||
AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index);
|
AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ Town::~Town()
|
||||||
|
|
||||||
/* Delete town authority window
|
/* Delete town authority window
|
||||||
* and remove from list of sorted towns */
|
* 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. */
|
/* Check no industry is related to us. */
|
||||||
#ifdef WITH_ASSERT
|
#ifdef WITH_ASSERT
|
||||||
|
|
|
@ -1293,11 +1293,11 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
*/
|
*/
|
||||||
if (src == original_src_head && src->IsEngine() && !src->IsFrontEngine()) {
|
if (src == original_src_head && src->IsEngine() && !src->IsFrontEngine()) {
|
||||||
/* Cases #2 and #3: the front engine gets trashed. */
|
/* Cases #2 and #3: the front engine gets trashed. */
|
||||||
DeleteWindowById(WC_VEHICLE_VIEW, src->index);
|
CloseWindowById(WC_VEHICLE_VIEW, src->index);
|
||||||
DeleteWindowById(WC_VEHICLE_ORDERS, src->index);
|
CloseWindowById(WC_VEHICLE_ORDERS, src->index);
|
||||||
DeleteWindowById(WC_VEHICLE_REFIT, src->index);
|
CloseWindowById(WC_VEHICLE_REFIT, src->index);
|
||||||
DeleteWindowById(WC_VEHICLE_DETAILS, src->index);
|
CloseWindowById(WC_VEHICLE_DETAILS, src->index);
|
||||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, src->index);
|
CloseWindowById(WC_VEHICLE_TIMETABLE, src->index);
|
||||||
DeleteNewGRFInspectWindow(GSF_TRAINS, src->index);
|
DeleteNewGRFInspectWindow(GSF_TRAINS, src->index);
|
||||||
SetWindowDirty(WC_COMPANY, _current_company);
|
SetWindowDirty(WC_COMPANY, _current_company);
|
||||||
|
|
||||||
|
|
|
@ -843,11 +843,11 @@ void Vehicle::PreDestructor()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->IsPrimaryVehicle()) {
|
if (this->IsPrimaryVehicle()) {
|
||||||
DeleteWindowById(WC_VEHICLE_VIEW, this->index);
|
CloseWindowById(WC_VEHICLE_VIEW, this->index);
|
||||||
DeleteWindowById(WC_VEHICLE_ORDERS, this->index);
|
CloseWindowById(WC_VEHICLE_ORDERS, this->index);
|
||||||
DeleteWindowById(WC_VEHICLE_REFIT, this->index);
|
CloseWindowById(WC_VEHICLE_REFIT, this->index);
|
||||||
DeleteWindowById(WC_VEHICLE_DETAILS, this->index);
|
CloseWindowById(WC_VEHICLE_DETAILS, this->index);
|
||||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->index);
|
CloseWindowById(WC_VEHICLE_TIMETABLE, this->index);
|
||||||
SetWindowDirty(WC_COMPANY, this->owner);
|
SetWindowDirty(WC_COMPANY, this->owner);
|
||||||
OrderBackup::ClearVehicle(this);
|
OrderBackup::ClearVehicle(this);
|
||||||
}
|
}
|
||||||
|
@ -2795,7 +2795,7 @@ void Vehicle::RemoveFromShared()
|
||||||
|
|
||||||
if (this->orders.list->GetNumVehicles() == 1) {
|
if (this->orders.list->GetNumVehicles() == 1) {
|
||||||
/* When there is only one vehicle, remove the shared order list window. */
|
/* 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);
|
InvalidateVehicleOrder(this->FirstShared(), VIWD_MODIFY_ORDERS);
|
||||||
} else if (were_first) {
|
} else if (were_first) {
|
||||||
/* If we were the first one, update to the new first one.
|
/* If we were the first one, update to the new first one.
|
||||||
|
|
|
@ -1118,7 +1118,7 @@ static WindowDesc _vehicle_refit_desc(
|
||||||
*/
|
*/
|
||||||
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit)
|
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);
|
RefitWindow *w = new RefitWindow(&_vehicle_refit_desc, v, order, auto_refit);
|
||||||
w->parent = parent;
|
w->parent = parent;
|
||||||
}
|
}
|
||||||
|
@ -2462,8 +2462,8 @@ static WindowDesc _nontrain_vehicle_details_desc(
|
||||||
/** Shows the vehicle details window of the given vehicle. */
|
/** Shows the vehicle details window of the given vehicle. */
|
||||||
static void ShowVehicleDetailsWindow(const Vehicle *v)
|
static void ShowVehicleDetailsWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
CloseWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
||||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, 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);
|
AllocateWindowDescFront<VehicleDetailsWindow>((v->type == VEH_TRAIN) ? &_train_vehicle_details_desc : &_nontrain_vehicle_details_desc, v->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2720,10 +2720,10 @@ public:
|
||||||
|
|
||||||
void Close() override
|
void Close() override
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_VEHICLE_ORDERS, this->window_number, false);
|
CloseWindowById(WC_VEHICLE_ORDERS, this->window_number, false);
|
||||||
DeleteWindowById(WC_VEHICLE_REFIT, this->window_number, false);
|
CloseWindowById(WC_VEHICLE_REFIT, this->window_number, false);
|
||||||
DeleteWindowById(WC_VEHICLE_DETAILS, this->window_number, false);
|
CloseWindowById(WC_VEHICLE_DETAILS, this->window_number, false);
|
||||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->window_number, false);
|
CloseWindowById(WC_VEHICLE_TIMETABLE, this->window_number, false);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2647,7 +2647,7 @@ static inline void ShowMeasurementTooltips(StringID str, uint paramcount, const
|
||||||
|
|
||||||
static void HideMeasurementTooltips()
|
static void HideMeasurementTooltips()
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_TOOLTIPS, 0);
|
CloseWindowById(WC_TOOLTIPS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** highlighting tiles while only going over them with the mouse */
|
/** highlighting tiles while only going over them with the mouse */
|
||||||
|
|
|
@ -51,7 +51,7 @@ void Waypoint::GetTileArea(TileArea *ta, StationType type) const
|
||||||
Waypoint::~Waypoint()
|
Waypoint::~Waypoint()
|
||||||
{
|
{
|
||||||
if (CleaningPool()) return;
|
if (CleaningPool()) return;
|
||||||
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
|
CloseWindowById(WC_WAYPOINT_VIEW, this->index);
|
||||||
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
|
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
|
||||||
if (this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index));
|
if (this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index));
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
|
|
||||||
void Close() override
|
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();
|
this->Window::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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 */
|
/* The preferred position is just below the dropdown calling widget */
|
||||||
int top = w->top + wi_rect.bottom + 1;
|
int top = w->top + wi_rect.bottom + 1;
|
||||||
|
|
|
@ -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
|
* @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);
|
Window *child = FindChildWindow(this, wc);
|
||||||
while (child != nullptr) {
|
while (child != nullptr) {
|
||||||
|
@ -1118,7 +1118,7 @@ void Window::Close()
|
||||||
_focused_window = nullptr;
|
_focused_window = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->DeleteChildWindows();
|
this->CloseChildWindows();
|
||||||
|
|
||||||
this->SetDirty();
|
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 cls Window class
|
||||||
* @param number Number of the window within the 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);
|
Window *w = FindWindowById(cls, number);
|
||||||
if (w != nullptr && (force || (w->flags & WF_STICKY) == 0)) {
|
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
|
* @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. */
|
/* Note: the container remains stable, even when deleting windows. */
|
||||||
for (Window *w : Window::Iterate()) {
|
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
|
* 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
|
* @param id company identifier
|
||||||
*/
|
*/
|
||||||
void DeleteCompanyWindows(CompanyID id)
|
void CloseCompanyWindows(CompanyID id)
|
||||||
{
|
{
|
||||||
/* Note: the container remains stable, even when deleting windows. */
|
/* Note: the container remains stable, even when deleting windows. */
|
||||||
for (Window *w : Window::Iterate()) {
|
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. */
|
/* 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;
|
_drag_delta.y = w->top - _cursor.pos.y;
|
||||||
|
|
||||||
BringWindowToFront(w);
|
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;
|
_drag_delta.y = _cursor.pos.y;
|
||||||
|
|
||||||
BringWindowToFront(w);
|
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,
|
* Non-vital windows are windows other than the game selection, main toolbar,
|
||||||
* status bar, toolbar menu, and tooltip windows. Stickied windows are also
|
* status bar, toolbar menu, and tooltip windows. Stickied windows are also
|
||||||
* considered vital.
|
* considered vital.
|
||||||
*/
|
*/
|
||||||
void DeleteNonVitalWindows()
|
void CloseNonVitalWindows()
|
||||||
{
|
{
|
||||||
/* Note: the container remains stable, even when deleting windows. */
|
/* Note: the container remains stable, even when deleting windows. */
|
||||||
for (Window *w : Window::Iterate()) {
|
for (Window *w : Window::Iterate()) {
|
||||||
|
@ -3281,12 +3281,12 @@ void DeleteNonVitalWindows()
|
||||||
* then, does a little hacked loop of closing all stickied windows. Note
|
* 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
|
* 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 */
|
/* Close every window except for stickied ones, then sticky ones as well */
|
||||||
DeleteNonVitalWindows();
|
CloseNonVitalWindows();
|
||||||
|
|
||||||
/* Note: the container remains stable, even when deleting windows. */
|
/* Note: the container remains stable, even when closing windows. */
|
||||||
for (Window *w : Window::Iterate()) {
|
for (Window *w : Window::Iterate()) {
|
||||||
if (w->flags & WF_STICKY) {
|
if (w->flags & WF_STICKY) {
|
||||||
w->Close();
|
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()
|
void DeleteAllMessages()
|
||||||
{
|
{
|
||||||
InitNewsItemStructs();
|
InitNewsItemStructs();
|
||||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
|
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
|
||||||
InvalidateWindowData(WC_MESSAGE_HISTORY, 0); // invalidate the message history
|
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.
|
* 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. */
|
/* Note: the container remains stable, even when deleting windows. */
|
||||||
for (Window *w : Window::Iterate()) {
|
for (Window *w : Window::Iterate()) {
|
||||||
|
@ -3321,11 +3321,11 @@ void DeleteConstructionWindows()
|
||||||
for (const Window *w : Window::Iterate()) w->SetDirty();
|
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()
|
void HideVitalWindows()
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_MAIN_TOOLBAR, 0);
|
CloseWindowById(WC_MAIN_TOOLBAR, 0);
|
||||||
DeleteWindowById(WC_STATUS_BAR, 0);
|
CloseWindowById(WC_STATUS_BAR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Re-initialize all windows. */
|
/** Re-initialize all windows. */
|
||||||
|
@ -3443,7 +3443,7 @@ void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index)
|
||||||
*/
|
*/
|
||||||
void RelocateAllWindows(int neww, int newh)
|
void RelocateAllWindows(int neww, int newh)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_DROPDOWN_MENU, 0);
|
CloseWindowById(WC_DROPDOWN_MENU, 0);
|
||||||
|
|
||||||
for (Window *w : Window::Iterate()) {
|
for (Window *w : Window::Iterate()) {
|
||||||
int left, top;
|
int left, top;
|
||||||
|
|
|
@ -36,10 +36,10 @@ void InputLoop();
|
||||||
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0, bool gui_scope = false);
|
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 InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope = false);
|
||||||
|
|
||||||
void DeleteNonVitalWindows();
|
void CloseNonVitalWindows();
|
||||||
void DeleteAllNonVitalWindows();
|
void CloseAllNonVitalWindows();
|
||||||
void DeleteAllMessages();
|
void DeleteAllMessages();
|
||||||
void DeleteConstructionWindows();
|
void CloseConstructionWindows();
|
||||||
void HideVitalWindows();
|
void HideVitalWindows();
|
||||||
void ShowVitalWindows();
|
void ShowVitalWindows();
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_inde
|
||||||
void SetWindowDirty(WindowClass cls, WindowNumber number);
|
void SetWindowDirty(WindowClass cls, WindowNumber number);
|
||||||
void SetWindowClassesDirty(WindowClass cls);
|
void SetWindowClassesDirty(WindowClass cls);
|
||||||
|
|
||||||
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true);
|
void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true);
|
||||||
void DeleteWindowByClass(WindowClass cls);
|
void CloseWindowByClass(WindowClass cls);
|
||||||
|
|
||||||
bool EditBoxInGlobalFocus();
|
bool EditBoxInGlobalFocus();
|
||||||
bool FocusedWindowIsConsole();
|
bool FocusedWindowIsConsole();
|
||||||
|
|
|
@ -509,7 +509,7 @@ public:
|
||||||
void DrawSortButtonState(int widget, SortButtonState state) const;
|
void DrawSortButtonState(int widget, SortButtonState state) const;
|
||||||
static int SortButtonWidth();
|
static int SortButtonWidth();
|
||||||
|
|
||||||
void DeleteChildWindows(WindowClass wc = WC_INVALID) const;
|
void CloseChildWindows(WindowClass wc = WC_INVALID) const;
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
static void DeleteClosedWindows();
|
static void DeleteClosedWindows();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue