src/aircraft.h
author rubidium
Thu, 01 Feb 2007 15:49:12 +0000
changeset 5893 7e431a4abebb
parent 5854 9eee280920f0
child 5972 59953719a3ff
permissions -rw-r--r--
(svn r8511) -Codechange: make WindowClass an enumerated value.
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
3987
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
     3
#ifndef AIRCRAFT_H
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
     4
#define AIRCRAFT_H
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
     5
3963
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
     6
#include "station_map.h"
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
     7
#include "vehicle.h"
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
     8
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
     9
typedef enum AircraftSubTypes {
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
    10
	AIR_HELICOPTER = 0,
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
    11
	AIR_AIRCRAFT   = 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
    12
	AIR_SHADOW     = 4,
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
    13
	AIR_ROTOR      = 6
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
    14
} AircraftSubType;
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
    15
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
    16
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
    17
/** 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
    18
 * 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
    19
 * @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
    20
 * @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
    21
 * 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
    22
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
    23
{
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
	assert(v->type == VEH_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
    25
	/* 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
    26
	 * 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
    27
	 * 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
    28
	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
    29
}
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
3963
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    31
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    32
static inline bool IsAircraftInHangar(const Vehicle* v)
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    33
{
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    34
	assert(v->type == VEH_Aircraft);
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    35
	return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    36
}
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    37
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    38
static inline bool IsAircraftInHangarStopped(const Vehicle* v)
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    39
{
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    40
	return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
6cab57074a9a (svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
diff changeset
    41
}
3987
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
    42
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
    43
uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type);
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
    44
5780
b16aec7650c2 (svn r8332) -Codechange: moved DrawAircraftImage() and CcBuildAircraft() from build_vehicle_gui.cpp to aircraft_gui.cpp
bjarni
parents: 5475
diff changeset
    45
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
4653
9f72ab9dc4a7 (svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents: 3987
diff changeset
    46
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
4732
4f1c405ac96e (svn r6644) -Fix(r6637): remove inline to allow MSVC compilation
belugas
parents: 4725
diff changeset
    47
void HandleAircraftEnterHangar(Vehicle *v);
4653
9f72ab9dc4a7 (svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents: 3987
diff changeset
    48
3987
22972f38e240 (svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
peter1138
parents: 3963
diff changeset
    49
#endif /* AIRCRAFT_H */