summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-30 13:39:34 +0000
committerbjarni <bjarni@openttd.org>2006-09-30 13:39:34 +0000
commitf91c43d79211b35a7d40a57b495dad95be19ac1d (patch)
treed735e6703130f7e4733ae994c0173081b44b4641
parent925085e2eaf9eb58672cf75ccfa19b2d352392c1 (diff)
downloadopenttd-f91c43d79211b35a7d40a57b495dad95be19ac1d.tar.xz
(svn r6586) -Feature: [depot window] added a vehicle list window with all vehicles having a certain depot in their orders
It got one known issue though. The top bar got a plural issue so expect to see stuff like "1 trains" until we figure out why it behaves this way Added the button to the depot windows. Made the autoreplace button bigger while I was moving some widgets anyway Made road vehicle depot windows start with one more row to make room for the buttons
-rw-r--r--depot_gui.c29
-rw-r--r--lang/english.txt11
-rw-r--r--vehicle.c25
-rw-r--r--vehicle.h2
-rw-r--r--vehicle_gui.c61
-rw-r--r--vehicle_gui.h4
6 files changed, 111 insertions, 21 deletions
diff --git a/depot_gui.c b/depot_gui.c
index e52589291..27f94fcb4 100644
--- a/depot_gui.c
+++ b/depot_gui.c
@@ -42,6 +42,7 @@ typedef enum DepotWindowWidgets {
DEPOT_WIDGET_BUILD,
DEPOT_WIDGET_CLONE,
DEPOT_WIDGET_LOCATION,
+ DEPOT_WIDGET_VEHICLE_LIST,
DEPOT_WIDGET_AUTOREPLACE,
DEPOT_WIDGET_RESIZE,
DEPOT_WIDGET_LAST, // used to assert if DepotWindowWidgets and widget_moves got different lengths. Due to this usage, it needs to be last
@@ -63,6 +64,7 @@ static const byte widget_moves[] = {
WIDGET_MOVE_DOWN, // DEPOT_WIDGET_BUILD
WIDGET_MOVE_DOWN, // DEPOT_WIDGET_CLONE
WIDGET_MOVE_DOWN, // DEPOT_WIDGET_LOCATION
+ WIDGET_MOVE_DOWN_RIGHT, // DEPOT_WIDGET_VEHICLE_LIST
WIDGET_MOVE_DOWN_RIGHT, // DEPOT_WIDGET_AUTOREPLACE
WIDGET_MOVE_DOWN_RIGHT, // DEPOT_WIDGET_RESIZE
};
@@ -84,9 +86,9 @@ static const Widget _depot_widgets[] = {
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 270, 280, 14, 25, SPR_FLAG_VEH_STOPPED,STR_MASS_STOP_DEPOT_TOOLTIP}, // DEPOT_WIDGET_STOP_ALL
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 281, 292, 14, 25, SPR_FLAG_VEH_RUNNING,STR_MASS_START_DEPOT_TOOLTIP}, // DEPOT_WIDGET_START_ALL
- { WWT_IMGBTN, RESIZE_LRB, 14, 270, 292, 26, 60, 0x2A9, STR_NULL}, // DEPOT_WIDGET_SELL
+ { WWT_IMGBTN, RESIZE_LRB, 14, 270, 292, 26, 49, 0x2A9, STR_NULL}, // DEPOT_WIDGET_SELL
{ WWT_PANEL, RESIZE_LRTB, 14, 326, 348, 0, 0, 0x2BF, STR_DRAG_WHOLE_TRAIN_TO_SELL_TIP}, // DEPOT_WIDGET_SELL_CHAIN, trains only
- { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 270, 292, 61, 83, 0x0, STR_DEPOT_SELL_ALL_BUTTON_TIP}, // DEPOT_WIDGET_SELL_ALL
+ { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 270, 292, 50, 72, 0x0, STR_DEPOT_SELL_ALL_BUTTON_TIP}, // DEPOT_WIDGET_SELL_ALL
{ WWT_MATRIX, RESIZE_RB, 14, 0, 269, 14, 83, 0x0, STR_NULL}, // DEPOT_WIDGET_MATRIX
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 293, 304, 14, 83, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // DEPOT_WIDGET_V_SCROLL
@@ -98,7 +100,8 @@ static const Widget _depot_widgets[] = {
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 96, 84, 95, 0x0, STR_NULL}, // DEPOT_WIDGET_BUILD
{WWT_NODISTXTBTN, RESIZE_TB, 14, 97, 194, 84, 95, 0x0, STR_NULL}, // DEPOT_WIDGET_CLONE
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 195, 292, 84, 95, STR_00E4_LOCATION, STR_NULL}, // DEPOT_WIDGET_LOCATION
- { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 281, 292, 84, 95, 0x0, STR_DEPOT_AUTOREPLACE_TIP}, // DEPOT_WIDGET_AUTOREPLACE
+ { WWT_PUSHTXTBTN, RESIZE_LRTB, 14, 258, 269, 84, 95, 0x0, STR_NULL}, // DEPOT_WIDGET_VEHICLE_LIST
+ { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 270, 292, 73, 95, 0x0, STR_DEPOT_AUTOREPLACE_TIP}, // DEPOT_WIDGET_AUTOREPLACE
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 293, 304, 84, 95, 0x0, STR_RESIZE_BUTTON}, // DEPOT_WIDGET_RESIZE
{ WIDGETS_END},
};
@@ -114,7 +117,7 @@ static const WindowDesc _train_depot_desc = {
};
static const WindowDesc _road_depot_desc = {
- -1, -1, 315, 82,
+ -1, -1, 315, 96,
WC_VEHICLE_DEPOT,0,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_depot_widgets,
@@ -578,7 +581,7 @@ static void ResizeDepotButtons(Window *w)
/* We got the widget moved around. Now we will make some widgets to fill the gab between some widgets in equal sizes */
/* Make the buttons in the bottom equal in size */
- w->widget[DEPOT_WIDGET_LOCATION].right = w->widget[DEPOT_WIDGET_AUTOREPLACE].left - 1;
+ w->widget[DEPOT_WIDGET_LOCATION].right = w->widget[DEPOT_WIDGET_VEHICLE_LIST].left - 1;
w->widget[DEPOT_WIDGET_BUILD].right = w->widget[DEPOT_WIDGET_LOCATION].right / 3;
w->widget[DEPOT_WIDGET_LOCATION].left = w->widget[DEPOT_WIDGET_BUILD].right * 2;
w->widget[DEPOT_WIDGET_CLONE].left = w->widget[DEPOT_WIDGET_BUILD].right + 1;
@@ -652,6 +655,10 @@ static void DepotWndProc(Window *w, WindowEvent *e)
ShowDepotSellAllWindow(w->window_number, WP(w, depot_d).type);
break;
+ case DEPOT_WIDGET_VEHICLE_LIST:
+ ShowVehDepotOrders(GetTileOwner(w->window_number), WP(w, depot_d).type, w->window_number);
+ break;
+
case DEPOT_WIDGET_AUTOREPLACE:
DoCommandP(w->window_number, WP(w, depot_d).type, 0, NULL, CMD_DEPOT_MASS_AUTOREPLACE);
break;
@@ -778,6 +785,8 @@ static void SetupStringsForDepotWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_CLONE].data = STR_CLONE_TRAIN;
w->widget[DEPOT_WIDGET_CLONE].tooltips = STR_CLONE_TRAIN_DEPOT_INFO;
w->widget[DEPOT_WIDGET_LOCATION].tooltips = STR_8842_CENTER_MAIN_VIEW_ON_TRAIN;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].data = STR_TRAIN;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].tooltips = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TIP;
break;
case VEH_Road:
@@ -789,6 +798,8 @@ static void SetupStringsForDepotWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_CLONE].data = STR_CLONE_ROAD_VEHICLE;
w->widget[DEPOT_WIDGET_CLONE].tooltips = STR_CLONE_ROAD_VEHICLE_DEPOT_INFO;
w->widget[DEPOT_WIDGET_LOCATION].tooltips = STR_9025_CENTER_MAIN_VIEW_ON_ROAD;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].data = STR_LORRY;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].tooltips = STR_DEPOT_VEHICLE_ORDER_LIST_ROADVEH_TIP;
break;
case VEH_Ship:
@@ -800,6 +811,8 @@ static void SetupStringsForDepotWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_CLONE].data = STR_CLONE_SHIP;
w->widget[DEPOT_WIDGET_CLONE].tooltips = STR_CLONE_SHIP_DEPOT_INFO;
w->widget[DEPOT_WIDGET_LOCATION].tooltips = STR_9822_CENTER_MAIN_VIEW_ON_SHIP;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].data = STR_SHIP;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].tooltips = STR_DEPOT_VEHICLE_ORDER_LIST_SHIP_TIP;
break;
case VEH_Aircraft:
@@ -811,6 +824,8 @@ static void SetupStringsForDepotWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_CLONE].data = STR_CLONE_AIRCRAFT;
w->widget[DEPOT_WIDGET_CLONE].tooltips = STR_CLONE_AIRCRAFT_INFO_HANGAR_WINDOW;
w->widget[DEPOT_WIDGET_LOCATION].tooltips = STR_A024_CENTER_MAIN_VIEW_ON_HANGAR;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].data = STR_PLANE;
+ w->widget[DEPOT_WIDGET_VEHICLE_LIST].tooltips = STR_DEPOT_VEHICLE_ORDER_LIST_AIRCRAFT_TIP;
/* Special strings only for hangars (using hangar instead of depot and so on) */
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_HANGAR_TOOLTIP;
@@ -861,8 +876,8 @@ void ShowDepotWindow(TileIndex tile, byte type)
case VEH_Road:
horizontal = 10;
- vertical = - 14;
- w->vscroll.cap = 4;
+ vertical = - 14 + 14;
+ w->vscroll.cap = 5;
w->hscroll.cap = 5;
w->resize.step_width = 56;
w->resize.step_height = 14;
diff --git a/lang/english.txt b/lang/english.txt
index 2fd2055b2..76fc55d4e 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -2901,6 +2901,8 @@ STR_SEND_TO_DEPOTS_TIP :{BLACK}Send al
STR_SEND_TO_HANGARS :{BLACK}Send to Hangars
STR_SEND_TO_HANGARS_TIP :{BLACK}Send all aircraft in list to hangar. CTRL+click will only service
+### depot strings
+
STR_SELL :{BLACK}Sell
STR_DEPOT_SELL_ALL_VEHICLE_CONFIRM :{BLACK}You are about to sell all the vehicles in the depot.
STR_ARE_YOU_SURE :{BLACK}Are you sure?
@@ -2910,9 +2912,18 @@ STR_DEPOT_SELL_ALL_CANCEL_TIP :{BLACK}Do not s
STR_DEPOT_SELL_ALL_CANCEL_HANGAR_TIP :{BLACK}Do not sell all aircraft in the hangar
STR_DEPOT_SELL_ALL_BUTTON_TIP :{BLACK}Sell all vehicles in the depot
STR_DEPOT_SELL_ALL_BUTTON_HANGAR_TIP :{BLACK}Sell all aircraft in the hangar
+STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TIP :{BLACK}Get a list of all trains with the current depot in their orders
+STR_DEPOT_VEHICLE_ORDER_LIST_ROADVEH_TIP :{BLACK}Get a list of all road vehicles with the current depot in their orders
+STR_DEPOT_VEHICLE_ORDER_LIST_SHIP_TIP :{BLACK}Get a list of all ships with the current depot in their orders
+STR_DEPOT_VEHICLE_ORDER_LIST_AIRCRAFT_TIP :{BLACK}Get a list of all aircraft with any hangar at this airport in their orders
STR_DEPOT_AUTOREPLACE_TIP :{BLACK}Autoreplace all vehicles in the depot
STR_DEPOT_AUTOREPLACE_HANGAR_TIP :{BLACK}Autoreplace all aircraft in the hangar
+STR_VEHICLE_LIST_TRAIN_DEPOT :{BLACK}{STRING1} - {COMMA} Train{P "" s}
+STR_VEHICLE_LIST_ROADVEH_DEPOT :{BLACK}{STRING1} - {COMMA} Road Vehicle{P "" s}
+STR_VEHICLE_LIST_SHIP_DEPOT :{BLACK}{STRING1} - {COMMA} Ship{P "" s}
+STR_VEHICLE_LIST_AIRCRAFT_DEPOT :{BLACK}{STRING1} - {COMMA} Aircraft
+
STR_REPLACE_VEHICLES :{BLACK}Replace Vehicles
STR_REPLACE_VEHICLES_WHITE :{WHITE}Replace {STRING}
STR_REPLACE_VEHICLES_START :{BLACK}Start Replacing Vehicles
diff --git a/vehicle.c b/vehicle.c
index 1d46ef9cf..22a4aa0b0 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1606,7 +1606,7 @@ int32 CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (vehicle_list_window) {
uint16 window_type = p2 & VLW_MASK;
- engine_count = GenerateVehicleSortList((const Vehicle***)&vl, &engine_list_length, vehicle_type, _current_player, INVALID_STATION, INVALID_ORDER, window_type);
+ engine_count = GenerateVehicleSortList((const Vehicle***)&vl, &engine_list_length, vehicle_type, _current_player, INVALID_STATION, INVALID_ORDER, INVALID_STATION, window_type);
} else {
/* Get the list of vehicles in the depot */
BuildDepotVehicleList(vehicle_type, tile, &vl, &engine_list_length, &engine_count, NULL, NULL, NULL);
@@ -2292,7 +2292,7 @@ void BuildDepotVehicleList(byte type, TileIndex tile, Vehicle ***engine_list, ui
* @param window_type tells what kind of window the list is for. Use the VLW flags in vehicle_gui.h
* @return the number of vehicles added to the list
*/
-uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array, byte type, PlayerID owner, StationID station, OrderID order, uint16 window_type)
+uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array, byte type, PlayerID owner, StationID station, OrderID order, uint16 depot_airport_index, uint16 window_type)
{
const uint subtype = (type != VEH_Aircraft) ? Train_Front : 2;
uint n = 0;
@@ -2347,6 +2347,25 @@ uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array
break;
}
+ case VLW_DEPOT_LIST: {
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == type && (
+ (type == VEH_Train && IsFrontEngine(v)) ||
+ (type != VEH_Train && v->subtype <= subtype))) {
+ const Order *order;
+
+ FOR_VEHICLE_ORDERS(v, order) {
+ if (order->type == OT_GOTO_DEPOT && order->dest == depot_airport_index) {
+ if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, 25);
+ (*sort_list)[n++] = v;
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+
default: NOT_REACHED(); break;
}
@@ -2376,7 +2395,7 @@ int32 SendAllVehiclesToDepot(byte type, uint32 flags, bool service, PlayerID own
uint n, i;
uint16 array_length = 0;
- n = GenerateVehicleSortList(&sort_list, &array_length, type, owner, (vlw_flag == VLW_STATION_LIST) ? id : INVALID_STATION, (vlw_flag == VLW_SHARED_ORDERS) ? id : INVALID_ORDER, vlw_flag);
+ n = GenerateVehicleSortList(&sort_list, &array_length, type, owner, id, id, id, vlw_flag);
/* Send all the vehicles to a depot */
for (i = 0; i < n; i++) {
diff --git a/vehicle.h b/vehicle.h
index 34f9d2f29..efdba0a24 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -317,7 +317,7 @@ int CheckTrainStoppedInDepot(const Vehicle *v);
bool VehicleNeedsService(const Vehicle *v);
-uint GenerateVehicleSortList(const Vehicle*** sort_list, uint16 *length_of_array, byte type, PlayerID owner, StationID station, OrderID order, uint16 window_type);
+uint GenerateVehicleSortList(const Vehicle*** sort_list, uint16 *length_of_array, byte type, PlayerID owner, StationID station, OrderID order, uint16 depot_airport_index, uint16 window_type);
void BuildDepotVehicleList(byte type, TileIndex tile, Vehicle ***engine_list, uint16 *engine_list_length, uint16 *engine_count, Vehicle ***wagon_list, uint16 *wagon_list_length, uint16 *wagon_count);
int32 SendAllVehiclesToDepot(byte type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id);
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 3394671a4..f68fbdf09 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -132,13 +132,13 @@ void ResortVehicleLists(void)
}
}
-static void BuildVehicleList(vehiclelist_d* vl, PlayerID owner, StationID station, OrderID order, uint16 window_type)
+static void BuildVehicleList(vehiclelist_d* vl, PlayerID owner, StationID station, OrderID order, uint16 depot_airport_index, uint16 window_type)
{
if (!(vl->l.flags & VL_REBUILD)) return;
DEBUG(misc, 1) ("Building vehicle list for player %d station %d...", owner, station);
- vl->l.list_length = GenerateVehicleSortList(&vl->sort_list, &vl->length_of_sort_list, vl->vehicle_type, owner, station, order, window_type);
+ vl->l.list_length = GenerateVehicleSortList(&vl->sort_list, &vl->length_of_sort_list, vl->vehicle_type, owner, station, order, depot_airport_index, window_type);
vl->l.flags &= ~VL_REBUILD;
vl->l.flags |= VL_RESORT;
@@ -1324,6 +1324,16 @@ static void CreateVehicleListWindow(Window *w)
default: NOT_REACHED(); break;
}
break;
+
+ case VLW_DEPOT_LIST:
+ switch (vl->vehicle_type) {
+ case VEH_Train: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_TRAIN_DEPOT; break;
+ case VEH_Road: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_ROADVEH_DEPOT; break;
+ case VEH_Ship: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_SHIP_DEPOT; break;
+ case VEH_Aircraft: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_AIRCRAFT_DEPOT; break;
+ default: NOT_REACHED(); break;
+ }
+ break;
default: NOT_REACHED(); break;
}
@@ -1381,10 +1391,11 @@ static void DrawVehicleListWindow(Window *w)
const PlayerID owner = (PlayerID)w->caption_color;
const Player *p = GetPlayer(owner);
const uint16 window_type = w->window_number & VLW_MASK;
- const StationID station = (window_type == VLW_STATION_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
- const OrderID order = (window_type == VLW_SHARED_ORDERS) ? GB(w->window_number, 16, 16) : INVALID_ORDER;
+ const StationID station = (window_type == VLW_STATION_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
+ const OrderID order = (window_type == VLW_SHARED_ORDERS) ? GB(w->window_number, 16, 16) : INVALID_ORDER;
+ const uint16 depot_airport_index = (window_type == VLW_DEPOT_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
- BuildVehicleList(vl, owner, station, order, window_type);
+ BuildVehicleList(vl, owner, station, order, depot_airport_index, window_type);
SortVehicleList(vl);
SetVScrollCount(w, vl->l.list_length);
@@ -1410,6 +1421,22 @@ static void DrawVehicleListWindow(Window *w)
SetDParam(0, station);
SetDParam(1, w->vscroll.count);
break;
+
+ case VLW_DEPOT_LIST:
+ switch (vl->vehicle_type) {
+ case VEH_Train: SetDParam(0, STR_8800_TRAIN_DEPOT); break;
+ case VEH_Road: SetDParam(0, STR_9003_ROAD_VEHICLE_DEPOT); break;
+ case VEH_Ship: SetDParam(0, STR_9803_SHIP_DEPOT); break;
+ case VEH_Aircraft: SetDParam(0, STR_A002_AIRCRAFT_HANGAR); break;
+ default: NOT_REACHED(); break;
+ }
+ if (vl->vehicle_type == VEH_Aircraft) {
+ SetDParam(1, depot_airport_index); // Airport name
+ } else {
+ SetDParam(1, GetDepot(depot_airport_index)->town_index);
+ }
+ SetDParam(2, w->vscroll.count);
+ break;
default: NOT_REACHED(); break;
}
@@ -1615,13 +1642,15 @@ static const WindowDesc _player_vehicle_list_road_veh_desc = {
PlayerVehWndProc
};
-static void ShowVehicleListWindowLocal(PlayerID player, byte vehicle_type, StationID station, OrderID order, bool show_shared)
+static void ShowVehicleListWindowLocal(PlayerID player, byte vehicle_type, StationID station, OrderID order, uint16 depot_airport_index)
{
Window *w;
WindowNumber num = (vehicle_type << 11) | player;
- if (show_shared) {
+ if (order != INVALID_ORDER) {
num |= (order << 16) | VLW_SHARED_ORDERS;
+ } else if (depot_airport_index != INVALID_STATION) {
+ num |= (depot_airport_index << 16) | VLW_DEPOT_LIST;
} else if (station == INVALID_STATION) {
num |= VLW_STANDARD;
} else {
@@ -1639,11 +1668,25 @@ static void ShowVehicleListWindowLocal(PlayerID player, byte vehicle_type, Stati
void ShowVehicleListWindow(PlayerID player, StationID station, byte vehicle_type)
{
- ShowVehicleListWindowLocal(player, vehicle_type, station, INVALID_ORDER, false);
+ ShowVehicleListWindowLocal(player, vehicle_type, station, INVALID_ORDER, INVALID_STATION);
}
void ShowVehWithSharedOrders(Vehicle *v, byte vehicle_type)
{
if (v->orders == NULL) return; // no shared list to show
- ShowVehicleListWindowLocal(v->owner, vehicle_type, INVALID_STATION, v->orders->index, true);
+ ShowVehicleListWindowLocal(v->owner, vehicle_type, INVALID_STATION, v->orders->index, INVALID_STATION);
+}
+
+void ShowVehDepotOrders(PlayerID player, byte vehicle_type, TileIndex depot_tile)
+{
+ uint16 depot_airport_index;
+
+ if (vehicle_type == VEH_Aircraft) {
+ depot_airport_index = GetStationIndex(depot_tile);
+ } else {
+ Depot *depot = GetDepotByTile(depot_tile);
+ if (depot == NULL) return; // no depot to show
+ depot_airport_index = depot->index;
+ }
+ ShowVehicleListWindowLocal(player, vehicle_type, INVALID_STATION, INVALID_ORDER, depot_airport_index);
}
diff --git a/vehicle_gui.h b/vehicle_gui.h
index 8bcba82fd..1d01177da 100644
--- a/vehicle_gui.h
+++ b/vehicle_gui.h
@@ -20,12 +20,13 @@ enum {
VLW_STANDARD = 0 << 8,
VLW_SHARED_ORDERS = 1 << 8,
VLW_STATION_LIST = 2 << 8,
+ VLW_DEPOT_LIST = 3 << 8,
VLW_MASK = 0x700,
};
static inline bool ValidVLWFlags(uint16 flags)
{
- return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST);
+ return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST);
}
void PlayerVehWndProc(Window *w, WindowEvent *e);
@@ -54,5 +55,6 @@ int ShowAdditionalText(int x, int y, int w, EngineID engine);
void ShowVehicleListWindow(PlayerID player, StationID station, byte vehicle_type);
void ShowVehWithSharedOrders(Vehicle *v, byte vehicle_type);
+void ShowVehDepotOrders(PlayerID player, byte vehicle_type, TileIndex depot_tile);
#endif /* VEHICLE_GUI_H */