2006-06-05 13:43:41 +01:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-02-23 08:37:33 +00:00
|
|
|
/** @file aircraft.h */
|
2007-02-23 01:48:53 +00:00
|
|
|
|
2006-06-09 07:34:28 +01:00
|
|
|
#ifndef AIRCRAFT_H
|
|
|
|
#define AIRCRAFT_H
|
|
|
|
|
2006-06-05 13:43:41 +01:00
|
|
|
#include "station_map.h"
|
|
|
|
#include "vehicle.h"
|
|
|
|
|
2007-01-27 12:29:55 +00:00
|
|
|
typedef enum AircraftSubTypes {
|
|
|
|
AIR_HELICOPTER = 0,
|
|
|
|
AIR_AIRCRAFT = 2,
|
|
|
|
AIR_SHADOW = 4,
|
|
|
|
AIR_ROTOR = 6
|
|
|
|
} AircraftSubType;
|
|
|
|
|
|
|
|
|
|
|
|
/** Check if the aircraft type is a normal flying device; eg
|
|
|
|
* not a rotor or a shadow
|
|
|
|
* @param v vehicle to check
|
|
|
|
* @return Returns true if the aircraft is a helicopter/airplane and
|
|
|
|
* false if it is a shadow or a rotor) */
|
|
|
|
static inline bool IsNormalAircraft(const Vehicle *v)
|
|
|
|
{
|
|
|
|
assert(v->type == VEH_Aircraft);
|
|
|
|
/* To be fully correct the commented out functionality is the proper one,
|
|
|
|
* but since value can only be 0 or 2, it is sufficient to only check <= 2
|
|
|
|
* return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
|
|
|
|
return v->subtype <= AIR_AIRCRAFT;
|
|
|
|
}
|
|
|
|
|
2006-06-05 13:43:41 +01:00
|
|
|
|
|
|
|
static inline bool IsAircraftInHangar(const Vehicle* v)
|
|
|
|
{
|
|
|
|
assert(v->type == VEH_Aircraft);
|
|
|
|
return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool IsAircraftInHangarStopped(const Vehicle* v)
|
|
|
|
{
|
|
|
|
return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
|
|
|
|
}
|
2006-06-09 07:34:28 +01:00
|
|
|
|
2007-03-06 22:11:58 +00:00
|
|
|
/** Checks if an aircraft is buildable at the tile in question
|
|
|
|
* @param engine The engine to test
|
|
|
|
* @param tile The tile where the hangar is
|
|
|
|
* @return true if the aircraft can be build
|
|
|
|
*/
|
|
|
|
static inline bool IsAircraftBuildableAtStation(EngineID engine, TileIndex tile)
|
|
|
|
{
|
|
|
|
const Station *st = GetStationByTile(tile);
|
|
|
|
const AirportFTAClass *apc = st->Airport();
|
|
|
|
const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
|
|
|
|
|
2007-03-06 23:27:14 +00:00
|
|
|
return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0;
|
2007-03-06 22:11:58 +00:00
|
|
|
}
|
|
|
|
|
2007-02-20 06:39:09 +00:00
|
|
|
uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo*);
|
2006-06-09 07:34:28 +01:00
|
|
|
|
2007-01-21 22:57:52 +00:00
|
|
|
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
2006-09-27 16:40:55 +01:00
|
|
|
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
2006-10-05 03:26:27 +01:00
|
|
|
void HandleAircraftEnterHangar(Vehicle *v);
|
2007-02-10 13:37:32 +00:00
|
|
|
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
|
2006-09-27 16:40:55 +01:00
|
|
|
|
2007-02-20 06:39:09 +00:00
|
|
|
void UpdateAirplanesOnNewStation(const Station *st);
|
|
|
|
|
2006-06-09 07:34:28 +01:00
|
|
|
#endif /* AIRCRAFT_H */
|