author | translators |
Thu, 04 Dec 2008 18:47:20 +0000 | |
changeset 10404 | ea3784c0b3dd |
parent 10207 | c291a21b304e |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9111
48ce04029fe4
(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:
9060
diff
changeset
|
3 |
/** @file vehicle_gui.h Functions related to the vehicle's GUIs. */ |
6423
8e10e79e0fd1
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6385
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 |
|
9274
42b67e65f1c2
(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:
9183
diff
changeset
|
8 |
#include "window_type.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8106
diff
changeset
|
9 |
#include "vehicle_type.h" |
8771
cab6fdd47703
(svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents:
8769
diff
changeset
|
10 |
#include "order_type.h" |
8769
b554c4996eb1
(svn r12468) -Codechange: move some type related stuff from station.h (and openttd.h) to station_type.h.
rubidium
parents:
8350
diff
changeset
|
11 |
#include "station_type.h" |
8777
5ba12006e339
(svn r12476) -Codechange: split type engine related types from engine.h (and openttd.h) to engine_type.h.
rubidium
parents:
8773
diff
changeset
|
12 |
#include "engine_type.h" |
9949
392998225bdd
(svn r14104) -Feature: Add a window for waypoints, allowing to view all the trains having the selected waypoint in their orders.
belugas
parents:
9563
diff
changeset
|
13 |
#include "waypoint.h" |
1752
d65cd19f7117
(svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
matthijs
parents:
1246
diff
changeset
|
14 |
|
2436
7d5df545bd5d
(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); |
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10122
diff
changeset
|
16 |
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent); |
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 |
|
8350
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
18 |
/** Constants of vehicle view widget indices */ |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
19 |
enum VehicleViewWindowWidgets { |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
20 |
VVW_WIDGET_CLOSEBOX = 0, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
21 |
VVW_WIDGET_CAPTION, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
22 |
VVW_WIDGET_STICKY, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
23 |
VVW_WIDGET_PANEL, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
24 |
VVW_WIDGET_VIEWPORT, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
25 |
VVW_WIDGET_START_STOP_VEH, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
26 |
VVW_WIDGET_CENTER_MAIN_VIEH, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
27 |
VVW_WIDGET_GOTO_DEPOT, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
28 |
VVW_WIDGET_REFIT_VEH, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
29 |
VVW_WIDGET_SHOW_ORDERS, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
30 |
VVW_WIDGET_SHOW_DETAILS, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
31 |
VVW_WIDGET_CLONE_VEH, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
32 |
VVW_WIDGET_EMPTY_BOTTOM_RIGHT, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
33 |
VVW_WIDGET_RESIZE, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
34 |
VVW_WIDGET_TURN_AROUND, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
35 |
VVW_WIDGET_FORCE_PROCEED, |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
36 |
}; |
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
37 |
|
8979cccdbed2
(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents:
8212
diff
changeset
|
38 |
/** Vehicle List Window type flags */ |
4449
820974aaa4a6
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
39 |
enum { |
4546
507b7d9bd834
(svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask
Darkvater
parents:
4545
diff
changeset
|
40 |
VLW_STANDARD = 0 << 8, |
4449
820974aaa4a6
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
41 |
VLW_SHARED_ORDERS = 1 << 8, |
820974aaa4a6
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
42 |
VLW_STATION_LIST = 2 << 8, |
4681
bc077405e9a8
(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
|
43 |
VLW_DEPOT_LIST = 3 << 8, |
6643
f81bee57bc09
(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:
6638
diff
changeset
|
44 |
VLW_GROUP_LIST = 4 << 8, |
9963
9823664dd4af
(svn r14118) -Fix(r14104): typos creeping like bugs
belugas
parents:
9949
diff
changeset
|
45 |
VLW_WAYPOINT_LIST = 5 << 8, |
4546
507b7d9bd834
(svn r6378) -Codechange: Rename VLW_FLAGS to VLW_MASK as it is a mask
Darkvater
parents:
4545
diff
changeset
|
46 |
VLW_MASK = 0x700, |
4449
820974aaa4a6
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
47 |
}; |
820974aaa4a6
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
48 |
|
4506
e6a56518135c
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
49 |
static inline bool ValidVLWFlags(uint16 flags) |
e6a56518135c
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
50 |
{ |
6643
f81bee57bc09
(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:
6638
diff
changeset
|
51 |
return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST); |
4506
e6a56518135c
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
52 |
} |
e6a56518135c
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4485
diff
changeset
|
53 |
|
6385
78f5307ce501
(svn r9475) -Codechange: Allow the purchase details widget to expand dynamically if there's still not enough room for the text.
maedhros
parents:
6259
diff
changeset
|
54 |
int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number); |
842 | 55 |
|
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8106
diff
changeset
|
56 |
void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8106
diff
changeset
|
57 |
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count); |
4442
9f8bb348d58f
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
58 |
void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection); |
4542
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4506
diff
changeset
|
59 |
void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection); |
4442
9f8bb348d58f
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
60 |
|
6638
09c5d7bf69a5
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6423
diff
changeset
|
61 |
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type); |
4442
9f8bb348d58f
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
62 |
|
4932
4bf213d0ed53
(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
|
63 |
uint ShowAdditionalText(int x, int y, uint w, EngineID engine); |
4bf213d0ed53
(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
|
64 |
uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine); |
2552
5b586a545665
(svn r3081) -Codechange: [autoreplace] complete rewrite of autoreplace
bjarni
parents:
2548
diff
changeset
|
65 |
|
5745
c8069ea3af5d
(svn r8293) -Codechange: overloaded ShowVehicleListWindow() so it can open all types of vehicle lists (depending on arguments)
bjarni
parents:
5475
diff
changeset
|
66 |
void ShowVehicleListWindow(const Vehicle *v); |
9949
392998225bdd
(svn r14104) -Feature: Add a window for waypoints, allowing to view all the trains having the selected waypoint in their orders.
belugas
parents:
9563
diff
changeset
|
67 |
void ShowVehicleListWindow(const Waypoint *wp); |
10207
c291a21b304e
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents:
10184
diff
changeset
|
68 |
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type); |
c291a21b304e
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents:
10184
diff
changeset
|
69 |
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station); |
c291a21b304e
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents:
10184
diff
changeset
|
70 |
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile); |
4668
f7256d0e7682
(svn r6562) -Codechange: merged the vehicle list window widget arrays
bjarni
parents:
4642
diff
changeset
|
71 |
|
9060
f0f4674fe194
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
9043
diff
changeset
|
72 |
|
f0f4674fe194
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
9043
diff
changeset
|
73 |
/* ChangeVehicleViewWindow() moves all windows for one vehicle to another vehicle. |
f0f4674fe194
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
9043
diff
changeset
|
74 |
* For ease of use it can be called with both Vehicle pointers and VehicleIDs. */ |
f0f4674fe194
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
9043
diff
changeset
|
75 |
void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index); |
f0f4674fe194
(svn r12912) -Codechange: overloaded ChangeVehicleViewWindow() so each argument can be either a Vehicle pointer or a VehicleID
bjarni
parents:
9043
diff
changeset
|
76 |
|
6638
09c5d7bf69a5
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6423
diff
changeset
|
77 |
static inline uint GetVehicleListHeight(VehicleType type) |
4796
20f8d2582b7b
(svn r6718) -Codechange: added function to get the line height for a vehicle type
bjarni
parents:
4734
diff
changeset
|
78 |
{ |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
79 |
return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24; |
4796
20f8d2582b7b
(svn r6718) -Codechange: added function to get the line height for a vehicle type
bjarni
parents:
4734
diff
changeset
|
80 |
} |
20f8d2582b7b
(svn r6718) -Codechange: added function to get the line height for a vehicle type
bjarni
parents:
4734
diff
changeset
|
81 |
|
9043
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
82 |
/** Get WindowClass for vehicle list of given vehicle type |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
83 |
* @param vt vehicle type to check |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
84 |
* @return corresponding window class |
10207
c291a21b304e
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents:
10184
diff
changeset
|
85 |
* @note works only for company buildable vehicle types |
9043
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
86 |
*/ |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
87 |
static inline WindowClass GetWindowClassForVehicleType(VehicleType vt) |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
88 |
{ |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
89 |
switch (vt) { |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
90 |
default: NOT_REACHED(); |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
91 |
case VEH_TRAIN: return WC_TRAINS_LIST; |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
92 |
case VEH_ROAD: return WC_ROADVEH_LIST; |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
93 |
case VEH_SHIP: return WC_SHIPS_LIST; |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
94 |
case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST; |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
95 |
} |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
96 |
} |
eb4f06b99146
(svn r12862) -Codechange: reduce code duplication for VehicleType -> WindowClass lookup
smatz
parents:
8777
diff
changeset
|
97 |
|
7486
bf6a94009823
(svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus.
rubidium
parents:
6857
diff
changeset
|
98 |
/* Unified window procedure */ |
bf6a94009823
(svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus.
rubidium
parents:
6857
diff
changeset
|
99 |
void ShowVehicleViewWindow(const Vehicle *v); |
bf6a94009823
(svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus.
rubidium
parents:
6857
diff
changeset
|
100 |
|
9182
412cb6c0caf1
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
9174
diff
changeset
|
101 |
Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y); |
412cb6c0caf1
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
9174
diff
changeset
|
102 |
|
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
|
103 |
#endif /* VEHICLE_GUI_H */ |