author | Tero Marttila <terom@fixme.fi> |
Fri, 18 Jul 2008 21:28:42 +0300 | |
changeset 11175 | 020c61e39c94 |
parent 11031 | ff45fd174578 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10371
diff
changeset
|
3 |
/** @file vehicle_gui.h Functions related to the vehicle's GUIs. */ |
6919
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6711
diff
changeset
|
4 |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff
changeset
|
5 |
#ifndef VEHICLE_GUI_H |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff
changeset
|
6 |
#define VEHICLE_GUI_H |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff
changeset
|
7 |
|
10596
0ee9eba64c9c
(svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents:
10503
diff
changeset
|
8 |
#include "sortlist_type.h" |
0ee9eba64c9c
(svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents:
10503
diff
changeset
|
9 |
#include "window_type.h" |
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8602
diff
changeset
|
10 |
#include "vehicle_type.h" |
9267
71cf88230dc1
(svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents:
9265
diff
changeset
|
11 |
#include "order_type.h" |
9265
3988d0156a49
(svn r12468) -Codechange: move some type related stuff from station.h (and openttd.h) to station_type.h.
rubidium
parents:
8846
diff
changeset
|
12 |
#include "station_type.h" |
9273
ca5e00698c01
(svn r12476) -Codechange: split type engine related types from engine.h (and openttd.h) to engine_type.h.
rubidium
parents:
9269
diff
changeset
|
13 |
#include "engine_type.h" |
1752
cdbfb2f23e72
(svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
matthijs
parents:
1246
diff
changeset
|
14 |
|
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2186
diff
changeset
|
15 |
void DrawVehicleProfitButton(const Vehicle *v, int x, int y); |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4681
diff
changeset
|
16 |
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order); |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff
changeset
|
17 |
|
8846
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
18 |
/** Constants of vehicle view widget indices */ |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
19 |
enum VehicleViewWindowWidgets { |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
20 |
VVW_WIDGET_CLOSEBOX = 0, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
21 |
VVW_WIDGET_CAPTION, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
22 |
VVW_WIDGET_STICKY, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
23 |
VVW_WIDGET_PANEL, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
24 |
VVW_WIDGET_VIEWPORT, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
25 |
VVW_WIDGET_START_STOP_VEH, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
26 |
VVW_WIDGET_CENTER_MAIN_VIEH, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
27 |
VVW_WIDGET_GOTO_DEPOT, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
28 |
VVW_WIDGET_REFIT_VEH, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
29 |
VVW_WIDGET_SHOW_ORDERS, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
30 |
VVW_WIDGET_SHOW_DETAILS, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
31 |
VVW_WIDGET_CLONE_VEH, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
32 |
VVW_WIDGET_EMPTY_BOTTOM_RIGHT, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
33 |
VVW_WIDGET_RESIZE, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
34 |
VVW_WIDGET_TURN_AROUND, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
35 |
VVW_WIDGET_FORCE_PROCEED, |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
36 |
}; |
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
37 |
|
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
38 |
/** Start of functions regarding vehicle list windows */ |
7139
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
39 |
enum { |
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
40 |
PLY_WND_PRC__OFFSET_TOP_WIDGET = 26, |
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
41 |
PLY_WND_PRC__SIZE_OF_ROW_TINY = 13, |
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
42 |
PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26, |
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
43 |
PLY_WND_PRC__SIZE_OF_ROW_BIG = 36, |
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
44 |
PLY_WND_PRC__SIZE_OF_ROW_BIG2 = 39, |
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
45 |
}; |
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
46 |
|
8846
f3e877a92e2b
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8708
diff
changeset
|
47 |
/** Vehicle List Window type flags */ |
4449
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
48 |
enum { |
4546
9345e0569655
(svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask
Darkvater
parents:
4545
diff
changeset
|
49 |
VLW_STANDARD = 0 << 8, |
4449
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
50 |
VLW_SHARED_ORDERS = 1 << 8, |
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
51 |
VLW_STATION_LIST = 2 << 8, |
4681
7d7a89b32dd0
(svn r6586) -Feature: [depot window] added a vehicle list window with all vehicles having a certain depot in their orders
bjarni
parents:
4668
diff
changeset
|
52 |
VLW_DEPOT_LIST = 3 << 8, |
7139
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
53 |
VLW_GROUP_LIST = 4 << 8, |
4546
9345e0569655
(svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask
Darkvater
parents:
4545
diff
changeset
|
54 |
VLW_MASK = 0x700, |
4449
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
55 |
}; |
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
56 |
|
4506
0d8fcc0a4e49
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
57 |
static inline bool ValidVLWFlags(uint16 flags) |
0d8fcc0a4e49
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
58 |
{ |
7139
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
59 |
return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST); |
4506
0d8fcc0a4e49
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
60 |
} |
0d8fcc0a4e49
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
61 |
|
6711
02a4b7b630bc
(svn r9475) -Codechange: Allow the purchase details widget to expand dynamically if there's still not enough room for the text.
maedhros
parents:
6585
diff
changeset
|
62 |
int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number); |
842 | 63 |
|
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8602
diff
changeset
|
64 |
void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip); |
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8602
diff
changeset
|
65 |
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count); |
4442
8d8d0c2df7cb
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
66 |
void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection); |
4542
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4506
diff
changeset
|
67 |
void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection); |
4442
8d8d0c2df7cb
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
68 |
|
7134
c5a90dd41166
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6919
diff
changeset
|
69 |
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type); |
4442
8d8d0c2df7cb
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
70 |
|
4932
3567a3ec9d80
(svn r6912) - Feature: Show a list of cargo types that a vehicle is refittable to in the purchase information window. (mart3p)
peter1138
parents:
4930
diff
changeset
|
71 |
uint ShowAdditionalText(int x, int y, uint w, EngineID engine); |
3567a3ec9d80
(svn r6912) - Feature: Show a list of cargo types that a vehicle is refittable to in the purchase information window. (mart3p)
peter1138
parents:
4930
diff
changeset
|
72 |
uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine); |
2552
fb174febb0b1
(svn r3081) -Codechange: [autoreplace] complete rewrite of autoreplace
bjarni
parents:
2548
diff
changeset
|
73 |
|
5996
d4b66530ded4
(svn r8293) -Codechange: overloaded ShowVehicleListWindow() so it can open all types of vehicle lists (depending on arguments)
bjarni
parents:
5726
diff
changeset
|
74 |
void ShowVehicleListWindow(const Vehicle *v); |
7134
c5a90dd41166
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6919
diff
changeset
|
75 |
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type); |
c5a90dd41166
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6919
diff
changeset
|
76 |
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, StationID station); |
c5a90dd41166
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6919
diff
changeset
|
77 |
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, TileIndex depot_tile); |
4668
8b6035c51188
(svn r6562) -Codechange: merged the vehicle list window widget arrays
bjarni
parents:
4642
diff
changeset
|
78 |
|
7139
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7134
diff
changeset
|
79 |
void DrawSmallOrderList(const Vehicle *v, int x, int y); |
4734
20770a208a04
(svn r6646) -Codechange: [vehicle list window] Cleaned up the drawing code
bjarni
parents:
4712
diff
changeset
|
80 |
|
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8602
diff
changeset
|
81 |
void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip); |
4734
20770a208a04
(svn r6646) -Codechange: [vehicle list window] Cleaned up the drawing code
bjarni
parents:
4712
diff
changeset
|
82 |
|
10371
f4ebcb863ad6
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
10321
diff
changeset
|
83 |
|
f4ebcb863ad6
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
10321
diff
changeset
|
84 |
/* ChangeVehicleViewWindow() moves all windows for one vehicle to another vehicle. |
f4ebcb863ad6
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
10321
diff
changeset
|
85 |
* For ease of use it can be called with both Vehicle pointers and VehicleIDs. */ |
f4ebcb863ad6
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
10321
diff
changeset
|
86 |
void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index); |
f4ebcb863ad6
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
10321
diff
changeset
|
87 |
|
7134
c5a90dd41166
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6919
diff
changeset
|
88 |
static inline uint GetVehicleListHeight(VehicleType type) |
4796
7e40ab01097a
(svn r6718) -Codechange: added function to get the line height for a vehicle type
bjarni
parents:
4734
diff
changeset
|
89 |
{ |
6585
7da94b26498a
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6573
diff
changeset
|
90 |
return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24; |
4796
7e40ab01097a
(svn r6718) -Codechange: added function to get the line height for a vehicle type
bjarni
parents:
4734
diff
changeset
|
91 |
} |
7e40ab01097a
(svn r6718) -Codechange: added function to get the line height for a vehicle type
bjarni
parents:
4734
diff
changeset
|
92 |
|
10321
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
93 |
/** Get WindowClass for vehicle list of given vehicle type |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
94 |
* @param vt vehicle type to check |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
95 |
* @return corresponding window class |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
96 |
* @note works only for player buildable vehicle types |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
97 |
*/ |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
98 |
static inline WindowClass GetWindowClassForVehicleType(VehicleType vt) |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
99 |
{ |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
100 |
switch (vt) { |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
101 |
default: NOT_REACHED(); |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
102 |
case VEH_TRAIN: return WC_TRAINS_LIST; |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
103 |
case VEH_ROAD: return WC_ROADVEH_LIST; |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
104 |
case VEH_SHIP: return WC_SHIPS_LIST; |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
105 |
case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST; |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
106 |
} |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
107 |
} |
6d58c7470699
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
9273
diff
changeset
|
108 |
|
7982
539e32cc37ce
(svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus.
rubidium
parents:
7353
diff
changeset
|
109 |
/* Unified window procedure */ |
539e32cc37ce
(svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus.
rubidium
parents:
7353
diff
changeset
|
110 |
void ShowVehicleViewWindow(const Vehicle *v); |
539e32cc37ce
(svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus.
rubidium
parents:
7353
diff
changeset
|
111 |
|
10502
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
112 |
Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y); |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
113 |
|
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
114 |
typedef GUIList<const Vehicle*> GUIVehicleList; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
115 |
|
10503
f7032c1220d9
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
10502
diff
changeset
|
116 |
struct VehicleListBase { |
10502
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
117 |
GUIVehicleList vehicles; ///< The list of vehicles |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
118 |
Listing *sorting; ///< Pointer to the vehicle type related sorting. |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
119 |
VehicleType vehicle_type; ///< The vehicle type that is sorted |
11031
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
120 |
|
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
121 |
static const StringID vehicle_sorter_names[]; |
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
122 |
static GUIVehicleList::SortFunction *const vehicle_sorter_funcs[]; |
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
123 |
|
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
124 |
VehicleListBase() |
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
125 |
{ |
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
126 |
this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs); |
ff45fd174578
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
10621
diff
changeset
|
127 |
} |
10502
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
128 |
}; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
129 |
|
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
130 |
struct Sorting { |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
131 |
Listing aircraft; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
132 |
Listing roadveh; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
133 |
Listing ship; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
134 |
Listing train; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
135 |
}; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
136 |
|
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
137 |
extern Sorting _sorting; |
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
138 |
|
996d9308d650
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
10494
diff
changeset
|
139 |
/* sorter stuff */ |
10503
f7032c1220d9
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
10502
diff
changeset
|
140 |
void SortVehicleList(VehicleListBase *vl); |
f7032c1220d9
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
10502
diff
changeset
|
141 |
void BuildVehicleList(VehicleListBase *vl, PlayerID owner, uint16 index, uint16 window_type); |
9269
742671e649bb
(svn r12472) -Codechange: remove unneeded declaration of ViewPort and DrawPixelInfo.
rubidium
parents:
9267
diff
changeset
|
142 |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff
changeset
|
143 |
#endif /* VEHICLE_GUI_H */ |