diff --git a/src/station.cpp b/src/station.cpp index b25f48a3fb..47389d79cf 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 b50115726d..f56c2f01e3 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 bfcd98ec88..51c97de318 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 ce312ff090..6f5ca7c349 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 *