Change window close/deallocation to match upstream
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user