src/aircraft.h
author rubidium
Fri, 25 Apr 2008 15:22:32 +0000
changeset 9055 4dc6a0c0ef47
parent 9043 eb4f06b99146
child 9070 dd0121143eba
permissions -rw-r--r--
(svn r12897) -Codechange: some coding style in station_cmd.cpp.
3963
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
     1
/* $Id$ */
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
     2
6121
2aae24b0881f (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: 6117
diff changeset
     3
/** @file aircraft.h */
6117
6507b2a7e71d (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: 6087
diff changeset
     4
3987
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
     5
#ifndef AIRCRAFT_H
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
     6
#define AIRCRAFT_H
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
     7
3963
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
     8
#include "station_map.h"
8785
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents: 8467
diff changeset
     9
#include "station_base.h"
8144
65cec0877b78 (svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents: 7683
diff changeset
    10
#include "vehicle_base.h"
8786
1823ff88a054 (svn r12490) -Codechange: rename engine.h to engine_func.h and remove unneeded inclusions of engine.h and/or replace them with engine_type.h.
rubidium
parents: 8785
diff changeset
    11
#include "engine_func.h"
3963
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    12
6415
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    13
/** An aircraft can be one ot those types */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6245
diff changeset
    14
enum AircraftSubType {
6409
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    15
	AIR_HELICOPTER = 0, ///< an helicopter
6410
415e9d86dae0 (svn r9546) -Fix (r9545): several typos...
rubidium
parents: 6409
diff changeset
    16
	AIR_AIRCRAFT   = 2, ///< an airplane
6409
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    17
	AIR_SHADOW     = 4, ///< shadow of the aircraft
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    18
	AIR_ROTOR      = 6  ///< rotor of an helicopter
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6245
diff changeset
    19
};
5854
9eee280920f0 (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: 5780
diff changeset
    20
9eee280920f0 (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: 5780
diff changeset
    21
9eee280920f0 (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: 5780
diff changeset
    22
/** Check if the aircraft type is a normal flying device; eg
9eee280920f0 (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: 5780
diff changeset
    23
 * not a rotor or a shadow
9eee280920f0 (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: 5780
diff changeset
    24
 * @param v vehicle to check
9eee280920f0 (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: 5780
diff changeset
    25
 * @return Returns true if the aircraft is a helicopter/airplane and
9eee280920f0 (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: 5780
diff changeset
    26
 * false if it is a shadow or a rotor) */
9eee280920f0 (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: 5780
diff changeset
    27
static inline bool IsNormalAircraft(const Vehicle *v)
9eee280920f0 (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: 5780
diff changeset
    28
{
6259
471b91a4b1d8 (svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents: 6248
diff changeset
    29
	assert(v->type == VEH_AIRCRAFT);
5854
9eee280920f0 (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: 5780
diff changeset
    30
	/* To be fully correct the commented out functionality is the proper one,
9eee280920f0 (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: 5780
diff changeset
    31
	 * but since value can only be 0 or 2, it is sufficient to only check <= 2
9eee280920f0 (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: 5780
diff changeset
    32
	 * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
9eee280920f0 (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: 5780
diff changeset
    33
	return v->subtype <= AIR_AIRCRAFT;
9eee280920f0 (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: 5780
diff changeset
    34
}
9eee280920f0 (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: 5780
diff changeset
    35
7683
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    36
/** Checks if an aircraft can use the station in question
6237
69427b23257f (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: 6121
diff changeset
    37
 * @param engine The engine to test
7683
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    38
 * @param st The station
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    39
 * @return true if the aircraft can use the station
6237
69427b23257f (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: 6121
diff changeset
    40
 */
7683
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    41
static inline bool CanAircraftUseStation(EngineID engine, const Station *st)
6237
69427b23257f (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: 6121
diff changeset
    42
{
69427b23257f (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: 6121
diff changeset
    43
	const AirportFTAClass *apc = st->Airport();
69427b23257f (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: 6121
diff changeset
    44
	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
69427b23257f (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: 6121
diff changeset
    45
6245
a9033dde144b (svn r9048) -Fix r9040: non-bool used as bool
glx
parents: 6237
diff changeset
    46
	return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0;
6237
69427b23257f (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: 6121
diff changeset
    47
}
69427b23257f (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: 6121
diff changeset
    48
7683
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    49
/** Checks if an aircraft can use the station at the tile in question
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    50
 * @param engine The engine to test
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    51
 * @param tile The tile where the station is
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    52
 * @return true if the aircraft can use the station
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    53
 */
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    54
static inline bool CanAircraftUseStation(EngineID engine, TileIndex tile)
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    55
{
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    56
	return CanAircraftUseStation(engine, GetStationByTile(tile));
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    57
}
13e6fb7baa57 (svn r11214) -Fix [FS#1296]: planes can't use heliports so refuse these orders
glx
parents: 7490
diff changeset
    58
6409
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    59
/**
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    60
 * Calculates cargo capacity based on an aircraft's passenger
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    61
 * and mail capacities.
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    62
 * @param cid Which cargo type to calculate a capacity for.
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    63
 * @param avi Which engine to find a cargo capacity for.
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    64
 * @return New cargo capacity value.
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    65
 */
6410
415e9d86dae0 (svn r9546) -Fix (r9545): several typos...
rubidium
parents: 6409
diff changeset
    66
uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi);
3987
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
    67
6415
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    68
/**
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    69
 * This is the Callback method after the construction attempt of an aircraft
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    70
 * @param success indicates completion (or not) of the operation
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    71
 * @param tile of depot where aircraft is built
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    72
 * @param p1 unused
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    73
 * @param p2 unused
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    74
 */
5780
b16aec7650c2 (svn r8332) -Codechange: moved DrawAircraftImage() and CcBuildAircraft() from build_vehicle_gui.cpp to aircraft_gui.cpp
bjarni
parents: 5475
diff changeset
    75
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
6415
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    76
6409
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    77
/** Handle Aircraft specific tasks when a an Aircraft enters a hangar
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    78
 * @param *v Vehicle that enters the hangar
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    79
 */
4732
4f1c405ac96e (svn r6644) -Fix(r6637): remove inline to allow MSVC compilation
belugas
parents: 4725
diff changeset
    80
void HandleAircraftEnterHangar(Vehicle *v);
6409
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    81
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    82
/** Get the size of the sprite of an aircraft sprite heading west (used for lists)
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    83
 * @param engine The engine to get the sprite from
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    84
 * @param width The width of the sprite
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    85
 * @param height The height of the sprite
2dc181151153 (svn r9545) -Documentation: Some corrections to previous doxygen work
belugas
parents: 6259
diff changeset
    86
 */
5972
59953719a3ff (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: 5854
diff changeset
    87
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
4653
9f72ab9dc4a7 (svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents: 3987
diff changeset
    88
6415
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    89
/**
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    90
 * Updates the status of the Aircraft heading or in the station
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    91
 * @param st Station been updated
cb61e1346600 (svn r9551) -Documentation: Some more doxygen work
belugas
parents: 6410
diff changeset
    92
 */
6087
bfa159e740d9 (svn r8822) -Fix
tron
parents: 5972
diff changeset
    93
void UpdateAirplanesOnNewStation(const Station *st);
bfa159e740d9 (svn r8822) -Fix
tron
parents: 5972
diff changeset
    94
6490
fe4443fba5e3 (svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents: 6415
diff changeset
    95
/** Update cached values of an aircraft.
fe4443fba5e3 (svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents: 6415
diff changeset
    96
 * Currently caches callback 36 max speed.
fe4443fba5e3 (svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents: 6415
diff changeset
    97
 * @param v Vehicle
fe4443fba5e3 (svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents: 6415
diff changeset
    98
 */
fe4443fba5e3 (svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents: 6415
diff changeset
    99
void UpdateAircraftCache(Vehicle *v);
fe4443fba5e3 (svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents: 6415
diff changeset
   100
6552
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   101
/**
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   102
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   103
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   104
 * and you reinitialize that to a Train using:
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   105
 *   v = new (v) Aircraft();
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   106
 *
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   107
 * As side-effect the vehicle type is set correctly.
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   108
 */
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   109
struct Aircraft : public Vehicle {
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   110
	/** Initializes the Vehicle to an aircraft */
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   111
	Aircraft() { this->type = VEH_AIRCRAFT; }
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   112
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   113
	/** We want to 'destruct' the right class. */
7412
51db351a3313 (svn r10798) -Fix [FS#1105]: virtual functions do not work in destructors :(.
rubidium
parents: 7318
diff changeset
   114
	virtual ~Aircraft() { this->PreDestructor(); }
6552
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   115
6563
fed2a162046b (svn r9765) -Codechange: constify some class functions.
rubidium
parents: 6562
diff changeset
   116
	const char *GetTypeString() const { return "aircraft"; }
6553
976a684212ad (svn r9755) -Codechange: refactor some more of the begin loading stuff.
rubidium
parents: 6552
diff changeset
   117
	void MarkDirty();
6558
c88e142f896e (svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents: 6553
diff changeset
   118
	void UpdateDeltaXY(Direction direction);
6563
fed2a162046b (svn r9765) -Codechange: constify some class functions.
rubidium
parents: 6562
diff changeset
   119
	ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
6773
bc98b0b16ec4 (svn r10009) -Codechange: Add and use Vehicle::IsPrimaryVehicle to replace individual checks depending on the vehicle type.
maedhros
parents: 6563
diff changeset
   120
	bool IsPrimaryVehicle() const { return IsNormalAircraft(this); }
9022
8fa9e902b06e (svn r12824) -Codechange: Standardise routines for drawing vehicle images, using correct types and less duplication.
peter1138
parents: 8890
diff changeset
   121
	SpriteID GetImage(Direction direction) const;
7477
ee28f55ab5e8 (svn r10984) -Codechange: unify the way one can get the current speed in the same forwat so we can display it.
rubidium
parents: 7412
diff changeset
   122
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
7484
7734e4119e70 (svn r10995) -Codechange: unify the way to get the displayed maxium speed of a vehicle. Patch by nycom.
rubidium
parents: 7478
diff changeset
   123
	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
7488
6f51ddf4c225 (svn r10999) -Codechange: unify the way the running cost of a vehicle is determined. Patch by nycom.
rubidium
parents: 7484
diff changeset
   124
	Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; }
7490
bb27d92565d3 (svn r11001) -Codechange: unify the way to determine whether a vehicle is in a depot.
rubidium
parents: 7488
diff changeset
   125
	bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
7135
3c1bcca0d6bb (svn r10409) -Codechange: replace (Aircraft|RoadVeh|Ship|Train)_Tick with a Tick method in the Vehicle class.
rubidium
parents: 7134
diff changeset
   126
	void Tick();
8467
605661f3a91c (svn r12037) -Codechange: replace OnNewDay_(Aircraft|RoadVeh|Ship|Train) with an OnNewDay method in the Vehicle class
glx
parents: 8211
diff changeset
   127
	void OnNewDay();
8830
b288359ab100 (svn r12578) -Codechange: merge the aircrafts ProcessOrder too into the 'unified' ProcessOrder.
rubidium
parents: 8786
diff changeset
   128
	TileIndex GetOrderStationLocation(StationID station);
8890
8a0fa7ff70a0 (svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents: 8830
diff changeset
   129
	bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
6552
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   130
};
d87268e08799 (svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents: 6490
diff changeset
   131
3987
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
   132
#endif /* AIRCRAFT_H */