(svn r19957) -Codechange: remove VLW_WAYPOINT_LIST

This commit is contained in:
smatz 2010-06-11 00:18:28 +00:00
parent 8bf4a7d1ae
commit c4175b752a
6 changed files with 19 additions and 54 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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() &&

View File

@ -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();
}

View File

@ -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;
}
}