mirror of https://github.com/OpenTTD/OpenTTD
(svn r27030) -Fix: crash when having the vehicle list opened from a buoy or oil rig while the buoy/oil rig gets its final removal (i.e. the sign gets removed)
parent
96c321e958
commit
e811fa1718
|
@ -45,13 +45,10 @@ BaseStation::~BaseStation()
|
||||||
|
|
||||||
if (CleaningPool()) return;
|
if (CleaningPool()) return;
|
||||||
|
|
||||||
Owner owner = this->owner;
|
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).Pack());
|
||||||
if (!Company::IsValidID(owner)) owner = _local_company;
|
DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->index).Pack());
|
||||||
if (!Company::IsValidID(owner)) return; // Spectators
|
DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).Pack());
|
||||||
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, owner, this->index).Pack());
|
DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack());
|
||||||
DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, owner, this->index).Pack());
|
|
||||||
DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, owner, this->index).Pack());
|
|
||||||
DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, owner, this->index).Pack());
|
|
||||||
|
|
||||||
this->sign.MarkDirty();
|
this->sign.MarkDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1303,17 +1303,15 @@ struct StationViewWindow : public Window {
|
||||||
this->SelectSortBy(_settings_client.gui.station_gui_sort_by);
|
this->SelectSortBy(_settings_client.gui.station_gui_sort_by);
|
||||||
this->sort_orders[0] = SO_ASCENDING;
|
this->sort_orders[0] = SO_ASCENDING;
|
||||||
this->SelectSortOrder((SortOrder)_settings_client.gui.station_gui_sort_order);
|
this->SelectSortOrder((SortOrder)_settings_client.gui.station_gui_sort_order);
|
||||||
Owner owner = Station::Get(window_number)->owner;
|
this->owner = Station::Get(window_number)->owner;
|
||||||
if (owner != OWNER_NONE) this->owner = owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~StationViewWindow()
|
~StationViewWindow()
|
||||||
{
|
{
|
||||||
Owner owner = Station::Get(this->window_number)->owner;
|
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false);
|
||||||
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, owner, this->window_number).Pack(), false);
|
DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->window_number).Pack(), false);
|
||||||
DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, owner, this->window_number).Pack(), false);
|
DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->window_number).Pack(), false);
|
||||||
DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, owner, this->window_number).Pack(), false);
|
DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->window_number).Pack(), false);
|
||||||
DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, owner, this->window_number).Pack(), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
}
|
}
|
||||||
this->FinishInitNested(window_number);
|
this->FinishInitNested(window_number);
|
||||||
|
|
||||||
if (this->wp->owner != OWNER_NONE) this->owner = this->wp->owner;
|
this->owner = this->wp->owner;
|
||||||
this->flags |= WF_DISABLE_VP_SCROLL;
|
this->flags |= WF_DISABLE_VP_SCROLL;
|
||||||
|
|
||||||
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_W_VIEWPORT);
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_W_VIEWPORT);
|
||||||
|
@ -78,13 +78,7 @@ public:
|
||||||
|
|
||||||
~WaypointWindow()
|
~WaypointWindow()
|
||||||
{
|
{
|
||||||
Owner owner = this->owner;
|
DeleteWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false);
|
||||||
|
|
||||||
/* Buoys have no owner and can be used by everyone. Show only 'our' vehicles */
|
|
||||||
if (!Company::IsValidID(owner)) owner = _local_company;
|
|
||||||
|
|
||||||
/* Well, spectators otoh */
|
|
||||||
if (Company::IsValidID(owner)) DeleteWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, owner, this->window_number).Pack(), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetStringParameters(int widget) const
|
virtual void SetStringParameters(int widget) const
|
||||||
|
|
|
@ -538,10 +538,12 @@ static inline void DrawCloseBox(const Rect &r, Colours colour)
|
||||||
*/
|
*/
|
||||||
void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
|
void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
|
||||||
{
|
{
|
||||||
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, FR_BORDERONLY);
|
bool company_owned = owner < MAX_COMPANIES;
|
||||||
DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, colour, (owner == INVALID_OWNER) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
|
|
||||||
|
|
||||||
if (owner != INVALID_OWNER) {
|
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, FR_BORDERONLY);
|
||||||
|
DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, colour, company_owned ? FR_LOWERED | FR_DARKENED | FR_BORDERONLY : FR_LOWERED | FR_DARKENED);
|
||||||
|
|
||||||
|
if (company_owned) {
|
||||||
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[owner]][4]);
|
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[owner]][4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue