summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/station.cpp11
-rw-r--r--src/station_gui.cpp12
-rw-r--r--src/waypoint_gui.cpp10
-rw-r--r--src/widget.cpp6
4 files changed, 15 insertions, 24 deletions
diff --git a/src/station.cpp b/src/station.cpp
index c035aafce..e0a48ef22 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -45,13 +45,10 @@ BaseStation::~BaseStation()
if (CleaningPool()) return;
- Owner owner = this->owner;
- if (!Company::IsValidID(owner)) owner = _local_company;
- if (!Company::IsValidID(owner)) return; // Spectators
- DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, 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());
+ DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).Pack());
+ DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->index).Pack());
+ DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).Pack());
+ DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack());
this->sign.MarkDirty();
}
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 12c22e1af..92b98dd39 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -1303,17 +1303,15 @@ struct StationViewWindow : public Window {
this->SelectSortBy(_settings_client.gui.station_gui_sort_by);
this->sort_orders[0] = SO_ASCENDING;
this->SelectSortOrder((SortOrder)_settings_client.gui.station_gui_sort_order);
- Owner owner = Station::Get(window_number)->owner;
- if (owner != OWNER_NONE) this->owner = owner;
+ this->owner = Station::Get(window_number)->owner;
}
~StationViewWindow()
{
- Owner owner = Station::Get(this->window_number)->owner;
- 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, 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, owner, this->window_number).Pack(), false);
+ DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false);
+ DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->window_number).Pack(), false);
+ DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->window_number).Pack(), false);
+ DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->window_number).Pack(), false);
}
/**
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index 3400a7df4..fa4deaac6 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -67,7 +67,7 @@ public:
}
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;
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_W_VIEWPORT);
@@ -78,13 +78,7 @@ public:
~WaypointWindow()
{
- Owner owner = this->owner;
-
- /* 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);
+ DeleteWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false);
}
virtual void SetStringParameters(int widget) const
diff --git a/src/widget.cpp b/src/widget.cpp
index 0532142ae..471840a41 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -538,10 +538,12 @@ static inline void DrawCloseBox(const Rect &r, Colours colour)
*/
void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
{
+ bool company_owned = owner < MAX_COMPANIES;
+
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, (owner == INVALID_OWNER) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | 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 (owner != INVALID_OWNER) {
+ if (company_owned) {
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[owner]][4]);
}