Change window close/deallocation to match upstream

This commit is contained in:
Jonathan G Rennison
2023-09-15 23:56:33 +01:00
parent 79cfc3e8bd
commit f5d1b1d8f8
50 changed files with 352 additions and 341 deletions

View File

@@ -480,9 +480,10 @@ public:
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
}
~CompanyStationsWindow()
void Close() override
{
this->last_sorting = this->stations.GetListing();
this->Window::Close();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
@@ -1435,7 +1436,7 @@ struct StationViewWindow : public Window {
ZoningStationWindowOpenClose(Station::Get(window_number));
}
~StationViewWindow()
void Close() override
{
ZoningStationWindowOpenClose(Station::Get(window_number));
CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false);
@@ -1444,6 +1445,7 @@ struct StationViewWindow : public Window {
CloseWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->window_number).Pack(), false);
SetViewportCatchmentStation(Station::Get(this->window_number), false);
this->Window::Close();
}
void OnInit() override
@@ -2545,11 +2547,12 @@ struct SelectStationWindow : Window {
_thd.freeze = true;
}
~SelectStationWindow()
void Close() override
{
SetViewportCatchmentStation(nullptr, true);
_thd.freeze = false;
this->Window::Close();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
@@ -2684,7 +2687,7 @@ static bool StationJoinerNeeded(const CommandContainer &cmd, TileArea ta)
Window *selection_window = FindWindowById(WC_SELECT_STATION, 0);
if (selection_window != nullptr) {
/* Abort current distant-join and start new one */
delete selection_window;
selection_window->Close();
UpdateTileSelection();
}
@@ -3097,7 +3100,7 @@ public:
void OnMouseLoop() override
{
if (!_cursor.in_window || !(_settings_client.gui.hover_delay_ms == 0 ? _right_button_down : _mouse_hovering)) {
delete this;
this->Close();
}
}
};