diff options
author | smatz <smatz@openttd.org> | 2010-06-11 00:18:28 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2010-06-11 00:18:28 +0000 |
commit | c4175b752a11b3b8c0c2d6b6677493f942b11fb8 (patch) | |
tree | baf7ed0749d967050706ed43dd709c99ea4d93fc /src | |
parent | 8bf4a7d1ae5643b20d842f7fe9637e453614b8aa (diff) | |
download | openttd-c4175b752a11b3b8c0c2d6b6677493f942b11fb8.tar.xz |
(svn r19957) -Codechange: remove VLW_WAYPOINT_LIST
Diffstat (limited to 'src')
-rw-r--r-- | src/station.cpp | 18 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 17 | ||||
-rw-r--r-- | src/vehicle_gui.h | 4 | ||||
-rw-r--r-- | src/vehiclelist.cpp | 21 | ||||
-rw-r--r-- | src/waypoint.cpp | 9 | ||||
-rw-r--r-- | src/waypoint_gui.cpp | 4 |
6 files changed, 19 insertions, 54 deletions
diff --git a/src/station.cpp b/src/station.cpp index b25f48a3f..47389d79c 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -35,6 +35,16 @@ BaseStation::~BaseStation() { free(this->name); free(this->speclist); + + if (CleaningPool()) return; + + Owner owner = this->owner; + if (!Company::IsValidID(owner)) owner = _local_company; + WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | owner; + DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11)); + DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11)); + DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11)); + DeleteWindowById(WC_AIRCRAFT_LIST, wno | (VEH_AIRCRAFT << 11)); } Station::Station(TileIndex tile) : @@ -83,14 +93,6 @@ Station::~Station() DeleteWindowById(WC_STATION_VIEW, index); - Owner owner = this->owner; - if (!Company::IsValidID(owner)) owner = _local_company; - WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | owner; - DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11)); - DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11)); - DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11)); - DeleteWindowById(WC_AIRCRAFT_LIST, wno | (VEH_AIRCRAFT << 11)); - /* Now delete all orders that go to the station */ RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index); diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index b50115726..f56c2f01e 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -43,6 +43,7 @@ #include "engine_base.h" #include "engine_func.h" #include "newgrf.h" +#include "station_base.h" #include "table/sprites.h" #include "table/strings.h" @@ -1076,14 +1077,8 @@ public: SetDParam(3, this->vscroll.GetCount()); break; - case VLW_WAYPOINT_LIST: - SetDParam(0, STR_WAYPOINT_NAME); - SetDParam(1, index); - SetDParam(3, this->vscroll.GetCount()); - break; - - case VLW_STATION_LIST: // Station Name - SetDParam(0, STR_STATION_NAME); + case VLW_STATION_LIST: // Station/Waypoint Name + SetDParam(0, Station::IsExpected(BaseStation::Get(index)) ? STR_STATION_NAME : STR_WAYPOINT_NAME); SetDParam(1, index); SetDParam(3, this->vscroll.GetCount()); break; @@ -1303,12 +1298,6 @@ void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type) } } -void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, const Waypoint *wp) -{ - if (wp == NULL) return; - ShowVehicleListWindowLocal(company, VLW_WAYPOINT_LIST, vehicle_type, wp->index); -} - void ShowVehicleListWindow(const Vehicle *v) { ShowVehicleListWindowLocal(v->owner, VLW_SHARED_ORDERS, v->type, v->FirstShared()->index); diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h index bfcd98ec8..51c97de31 100644 --- a/src/vehicle_gui.h +++ b/src/vehicle_gui.h @@ -53,13 +53,12 @@ enum VehicleListWindowType { VLW_STATION_LIST = 2 << 8, VLW_DEPOT_LIST = 3 << 8, VLW_GROUP_LIST = 4 << 8, - VLW_WAYPOINT_LIST = 5 << 8, VLW_MASK = 0x700, }; static inline bool ValidVLWFlags(uint16 flags) { - return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST || flags == VLW_WAYPOINT_LIST); + return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST); } int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number); @@ -75,7 +74,6 @@ uint ShowRefitOptionsList(int left, int right, int y, EngineID engine); StringID GetCargoSubtypeText(const Vehicle *v); void ShowVehicleListWindow(const Vehicle *v); -void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, const Waypoint *wp); void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type); void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station); void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile); diff --git a/src/vehiclelist.cpp b/src/vehiclelist.cpp index ce312ff09..6f5ca7c34 100644 --- a/src/vehiclelist.cpp +++ b/src/vehiclelist.cpp @@ -68,12 +68,11 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine * @param owner Company to generate list for * @param index This parameter has different meanings depending on window_type * <ul> - * <li>VLW_STATION_LIST: index of station to generate a list for</li> + * <li>VLW_STATION_LIST: index of station/waypoint to generate a list for</li> * <li>VLW_SHARED_ORDERS: index of order to generate a list for<li> * <li>VLW_STANDARD: not used<li> * <li>VLW_DEPOT_LIST: TileIndex of the depot/hangar to make the list for</li> * <li>VLW_GROUP_LIST: index of group to generate a list for</li> - * <li>VLW_WAYPOINT_LIST: index of waypoint to generate a list for</li> * </ul> * @param window_type The type of window the list is for, using the VLW_ flags in vehicle_gui.h * @return false if invalid list is requested @@ -91,7 +90,8 @@ bool GenerateVehicleSortList(VehicleList *list, VehicleType type, Owner owner, u const Order *order; FOR_VEHICLE_ORDERS(v, order) { - if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == index) { + if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT)) + && order->GetDestination() == index) { *list->Append() = v; break; } @@ -133,21 +133,6 @@ bool GenerateVehicleSortList(VehicleList *list, VehicleType type, Owner owner, u } break; - case VLW_WAYPOINT_LIST: - FOR_ALL_VEHICLES(v) { - if (v->type == type && v->IsPrimaryVehicle()) { - const Order *order; - - FOR_VEHICLE_ORDERS(v, order) { - if (order->IsType(OT_GOTO_WAYPOINT) && order->GetDestination() == index) { - *list->Append() = v; - break; - } - } - } - } - break; - case VLW_GROUP_LIST: FOR_ALL_VEHICLES(v) { if (v->type == type && v->IsPrimaryVehicle() && diff --git a/src/waypoint.cpp b/src/waypoint.cpp index 6ed11799b..bc7bf2975 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -15,9 +15,6 @@ #include "window_func.h" #include "newgrf_station.h" #include "waypoint_base.h" -#include "vehicle_gui.h" -#include "company_func.h" -#include "company_base.h" /** * Draw a waypoint @@ -56,11 +53,5 @@ Waypoint::~Waypoint() DeleteWindowById(WC_WAYPOINT_VIEW, this->index); RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index); - Owner owner = this->owner; - if (!Company::IsValidID(owner)) owner = _local_company; - WindowNumber wno = (this->index << 16) | VLW_WAYPOINT_LIST | owner; - DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11)); - DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11)); - this->sign.MarkDirty(); } diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index 630f4222a..3e7b3d44b 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -65,7 +65,7 @@ public: { Owner owner = this->owner; if (!Company::IsValidID(owner)) owner = _local_company; - DeleteWindowById(GetWindowClassForVehicleType(this->vt), (this->window_number << 16) | (this->vt << 11) | VLW_WAYPOINT_LIST | owner, false); + DeleteWindowById(GetWindowClassForVehicleType(this->vt), (this->window_number << 16) | (this->vt << 11) | VLW_STATION_LIST | owner, false); } virtual void SetStringParameters(int widget) const @@ -95,7 +95,7 @@ public: break; case WAYPVW_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders - ShowVehicleListWindow(this->owner, this->vt, this->wp); + ShowVehicleListWindow(this->owner, this->vt, this->wp->index); break; } } |