summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2010-06-10 23:27:37 +0000
committersmatz <smatz@openttd.org>2010-06-10 23:27:37 +0000
commit830e40af1999186630b5a85e7c3017617fc44576 (patch)
treee7aa1dc4fd13bfc7319bd33ff5c5060da7729e23
parentde50d914c8c205f17021f6ae74302afee92de157 (diff)
downloadopenttd-830e40af1999186630b5a85e7c3017617fc44576.tar.xz
(svn r19955) -Fix: close list of vehicles with given buoy/oil rig in orders when switching company
-rw-r--r--src/station_gui.cpp31
-rw-r--r--src/vehicle_gui.cpp7
-rw-r--r--src/waypoint_gui.cpp2
3 files changed, 12 insertions, 28 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 2dc5e80e2..3fa84f159 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -1183,33 +1183,12 @@ struct StationViewWindow : public Window {
this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
break;
- case SVW_TRAINS: { // Show a list of scheduled trains to this station
- const Station *st = Station::Get(this->window_number);
- ShowVehicleListWindow(st->owner, VEH_TRAIN, (StationID)this->window_number);
+ case SVW_TRAINS: // Show list of scheduled trains to this station
+ case SVW_ROADVEHS: // Show list of scheduled road-vehicles to this station
+ case SVW_PLANES: // Show list of scheduled aircraft to this station
+ case SVW_SHIPS: // Show list of scheduled ships to this station
+ ShowVehicleListWindow(this->owner, (VehicleType)(widget - SVW_TRAINS), (StationID)this->window_number);
break;
- }
-
- case SVW_ROADVEHS: { // Show a list of scheduled road-vehicles to this station
- const Station *st = Station::Get(this->window_number);
- ShowVehicleListWindow(st->owner, VEH_ROAD, (StationID)this->window_number);
- break;
- }
-
- case SVW_PLANES: { // Show a list of scheduled aircraft to this station
- const Station *st = Station::Get(this->window_number);
- /* Since oilrigs have no owners, show the scheduled aircraft of local company */
- Owner owner = (st->owner == OWNER_NONE) ? _local_company : st->owner;
- ShowVehicleListWindow(owner, VEH_AIRCRAFT, (StationID)this->window_number);
- break;
- }
-
- case SVW_SHIPS: { // Show a list of scheduled ships to this station
- const Station *st = Station::Get(this->window_number);
- /* Since oilrigs/bouys have no owners, show the scheduled ships of local company */
- Owner owner = (st->owner == OWNER_NONE) ? _local_company : st->owner;
- ShowVehicleListWindow(owner, VEH_SHIP, (StationID)this->window_number);
- break;
- }
}
}
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index bc286d81b..b50115726 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1277,7 +1277,12 @@ static WindowDesc _vehicle_list_desc(
static void ShowVehicleListWindowLocal(CompanyID company, uint16 VLW_flag, VehicleType vehicle_type, uint16 unique_number)
{
- if (!Company::IsValidID(company)) return;
+ if (!Company::IsValidID(company)) {
+ _vehicle_list_desc.flags |= WDF_CONSTRUCTION;
+ company = _local_company;
+ } else {
+ _vehicle_list_desc.flags &= ~WDF_CONSTRUCTION;
+ }
_vehicle_list_desc.cls = GetWindowClassForVehicleType(vehicle_type);
WindowNumber num = (unique_number << 16) | (vehicle_type << 11) | VLW_flag | company;
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index cc11ba812..72a629eab 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -87,7 +87,7 @@ public:
break;
case WAYPVW_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
- ShowVehicleListWindow((this->wp->owner == OWNER_NONE) ? _local_company : this->wp->owner, this->vt, this->wp);
+ ShowVehicleListWindow(this->owner, this->vt, this->wp);
break;
}
}