author | rubidium |
Tue, 22 Jan 2008 21:00:30 +0000 | |
branch | NewGRF_ports |
changeset 6872 | 1c4a4a609f85 |
parent 6870 | ca3fd1fbe311 |
child 6877 | 889301acc299 |
permissions | -rw-r--r-- |
3963
d7d284c2f1f7
(svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
d7d284c2f1f7
(svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff
changeset
|
2 |
|
6447
3b71e57fd22b
(svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents:
6443
diff
changeset
|
3 |
/** @file aircraft.h */ |
6443
b8f06d8eb7be
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6413
diff
changeset
|
4 |
|
3987
96b119a9fb94
(svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents:
3963
diff
changeset
|
5 |
#ifndef AIRCRAFT_H |
96b119a9fb94
(svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents:
3963
diff
changeset
|
6 |
#define AIRCRAFT_H |
96b119a9fb94
(svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents:
3963
diff
changeset
|
7 |
|
3963
d7d284c2f1f7
(svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff
changeset
|
8 |
#include "station_map.h" |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6870
diff
changeset
|
9 |
#include "vehicle_base.h" |
6868
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6862
diff
changeset
|
10 |
#include "engine.h" |
3963
d7d284c2f1f7
(svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff
changeset
|
11 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
12 |
/** An aircraft can be one ot those types */ |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6571
diff
changeset
|
13 |
enum AircraftSubType { |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
14 |
AIR_HELICOPTER = 0, ///< an helicopter |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
15 |
AIR_AIRCRAFT = 2, ///< an airplane |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
16 |
AIR_SHADOW = 4, ///< shadow of the aircraft |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
17 |
AIR_ROTOR = 6 ///< rotor of an helicopter |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6571
diff
changeset
|
18 |
}; |
6105
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
19 |
|
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
20 |
|
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
21 |
/** Check if the aircraft type is a normal flying device; eg |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
22 |
* not a rotor or a shadow |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
23 |
* @param v vehicle to check |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
24 |
* @return Returns true if the aircraft is a helicopter/airplane and |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
25 |
* false if it is a shadow or a rotor) */ |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
26 |
static inline bool IsNormalAircraft(const Vehicle *v) |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
27 |
{ |
6585
7da94b26498a
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6574
diff
changeset
|
28 |
assert(v->type == VEH_AIRCRAFT); |
6105
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
29 |
/* To be fully correct the commented out functionality is the proper one, |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
30 |
* but since value can only be 0 or 2, it is sufficient to only check <= 2 |
6862
0b2c0e2b5356
(svn r10976) [NewGRF_ports] -Change: Additional changes to further support seaplanes. Checks now made in IsAircraftBuildable for seaplane requirement.
richk
parents:
6800
diff
changeset
|
31 |
* return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); |
0b2c0e2b5356
(svn r10976) [NewGRF_ports] -Change: Additional changes to further support seaplanes. Checks now made in IsAircraftBuildable for seaplane requirement.
richk
parents:
6800
diff
changeset
|
32 |
* limited to lower 3 bits so that seaplanes are still regarded as normal aircraft */ |
0b2c0e2b5356
(svn r10976) [NewGRF_ports] -Change: Additional changes to further support seaplanes. Checks now made in IsAircraftBuildable for seaplane requirement.
richk
parents:
6800
diff
changeset
|
33 |
return (v->subtype & 0x07) <= AIR_AIRCRAFT; |
6105
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
34 |
} |
761d393829d6
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
6031
diff
changeset
|
35 |
|
6870
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
36 |
/** Checks if an aircraft can use the station in question |
6563
d08d813ecd42
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
bjarni
parents:
6447
diff
changeset
|
37 |
* @param engine The engine to test |
6870
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
38 |
* @param st The station |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
39 |
* @return true if the aircraft can use the station |
6563
d08d813ecd42
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
bjarni
parents:
6447
diff
changeset
|
40 |
*/ |
6870
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
41 |
static inline bool CanAircraftUseStation(EngineID engine, const Station *st) |
6563
d08d813ecd42
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
bjarni
parents:
6447
diff
changeset
|
42 |
{ |
6738
72d1a2997952
(svn r10683) [NewGRF_ports] -Revert: Too eager to un-const... global search/replace removed too many. Restores necessary ones... for the moment ;)
richk
parents:
6734
diff
changeset
|
43 |
const AirportFTAClass *apc = st->Airport(); |
6563
d08d813ecd42
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
bjarni
parents:
6447
diff
changeset
|
44 |
const AircraftVehicleInfo *avi = AircraftVehInfo(engine); |
d08d813ecd42
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
bjarni
parents:
6447
diff
changeset
|
45 |
|
6862
0b2c0e2b5356
(svn r10976) [NewGRF_ports] -Change: Additional changes to further support seaplanes. Checks now made in IsAircraftBuildable for seaplane requirement.
richk
parents:
6800
diff
changeset
|
46 |
if ((apc->flags & AirportFTAClass::SEAPLANES) && ((avi->subtype & AirportFTAClass::SEAPLANES) == 0)) return false; |
6571 | 47 |
return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0; |
6563
d08d813ecd42
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
bjarni
parents:
6447
diff
changeset
|
48 |
} |
d08d813ecd42
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
bjarni
parents:
6447
diff
changeset
|
49 |
|
6870
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
50 |
/** Checks if an aircraft can use the station at the tile in question |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
51 |
* @param engine The engine to test |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
52 |
* @param tile The tile where the station is |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
53 |
* @return true if the aircraft can use the station |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
54 |
*/ |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
55 |
static inline bool CanAircraftUseStation(EngineID engine, TileIndex tile) |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
56 |
{ |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
57 |
return CanAircraftUseStation(engine, GetStationByTile(tile)); |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
58 |
} |
ca3fd1fbe311
(svn r11219) [NewGRF_ports] -Sync: with trunk r11035:11218.
rubidium
parents:
6868
diff
changeset
|
59 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
60 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
61 |
* Calculates cargo capacity based on an aircraft's passenger |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
62 |
* and mail capacities. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
63 |
* @param cid Which cargo type to calculate a capacity for. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
64 |
* @param avi Which engine to find a cargo capacity for. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
65 |
* @return New cargo capacity value. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
66 |
*/ |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
67 |
uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi); |
3987
96b119a9fb94
(svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents:
3963
diff
changeset
|
68 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
69 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
70 |
* This is the Callback method after the construction attempt of an aircraft |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
71 |
* @param success indicates completion (or not) of the operation |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
72 |
* @param tile of depot where aircraft is built |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
73 |
* @param p1 unused |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
74 |
* @param p2 unused |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
75 |
*/ |
6031
f6d1eef3fa24
(svn r8332) -Codechange: moved DrawAircraftImage() and CcBuildAircraft() from build_vehicle_gui.cpp to aircraft_gui.cpp
bjarni
parents:
5726
diff
changeset
|
76 |
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2); |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
77 |
|
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
78 |
/** Handle Aircraft specific tasks when a an Aircraft enters a hangar |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
79 |
* @param *v Vehicle that enters the hangar |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
80 |
*/ |
4732
da9d305d1c94
(svn r6644) -Fix(r6637): remove inline to allow MSVC compilation
belugas
parents:
4725
diff
changeset
|
81 |
void HandleAircraftEnterHangar(Vehicle *v); |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
82 |
|
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
83 |
/** Get the size of the sprite of an aircraft sprite heading west (used for lists) |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
84 |
* @param engine The engine to get the sprite from |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
85 |
* @param width The width of the sprite |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
86 |
* @param height The height of the sprite |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
87 |
*/ |
6223
92d2073c3d7e
(svn r8661) -Fix: [depot windows] Enlarge the blocks in the depot window if a sprite is too big to fit (ships and aircraft only)
bjarni
parents:
6105
diff
changeset
|
88 |
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height); |
4653
091f530bae28
(svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents:
3987
diff
changeset
|
89 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
90 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
91 |
* Updates the status of the Aircraft heading or in the station |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
92 |
* @param st Station been updated |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
93 |
*/ |
6413 | 94 |
void UpdateAirplanesOnNewStation(const Station *st); |
95 |
||
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
96 |
/** Update cached values of an aircraft. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
97 |
* Currently caches callback 36 max speed. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
98 |
* @param v Vehicle |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
99 |
*/ |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
100 |
void UpdateAircraftCache(Vehicle *v); |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
101 |
|
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
102 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
103 |
* This class 'wraps' Vehicle; you do not actually instantiate this class. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
104 |
* You create a Vehicle using AllocateVehicle, so it is added to the pool |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
105 |
* and you reinitialize that to a Train using: |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
106 |
* v = new (v) Aircraft(); |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
107 |
* |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
108 |
* As side-effect the vehicle type is set correctly. |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
109 |
*/ |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
110 |
struct Aircraft : public Vehicle { |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
111 |
/** Initializes the Vehicle to an aircraft */ |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
112 |
Aircraft() { this->type = VEH_AIRCRAFT; } |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
113 |
|
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
114 |
/** We want to 'destruct' the right class. */ |
6800
6c09e1e86fcb
(svn r10872) [NewGRF_ports] -Sync: with trunk r10765:10871.
rubidium
parents:
6743
diff
changeset
|
115 |
virtual ~Aircraft() { this->PreDestructor(); } |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
116 |
|
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
117 |
const char *GetTypeString() const { return "aircraft"; } |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
118 |
void MarkDirty(); |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
119 |
void UpdateDeltaXY(Direction direction); |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
120 |
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; } |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
121 |
WindowClass GetVehicleListWindowClass() const { return WC_AIRCRAFT_LIST; } |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
122 |
bool IsPrimaryVehicle() const { return IsNormalAircraft(this); } |
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
123 |
int GetImage(Direction direction) const; |
6868
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6862
diff
changeset
|
124 |
int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; } |
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6862
diff
changeset
|
125 |
int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; } |
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6862
diff
changeset
|
126 |
Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; } |
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6862
diff
changeset
|
127 |
bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); } |
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
128 |
void Tick(); |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
129 |
}; |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6585
diff
changeset
|
130 |
|
3987
96b119a9fb94
(svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents:
3963
diff
changeset
|
131 |
#endif /* AIRCRAFT_H */ |