# aircraft.h File Reference

`#include "station_map.h"`
`#include "vehicle_base.h"`
`#include "engine.h"`

Go to the source code of this file.

## Data Structures
struct | Aircraft
| This class 'wraps' Vehicle; you do not actually instantiate this class. More...
## Enumerations
enum | AircraftSubType { AIR_HELICOPTER = 0, AIR_AIRCRAFT = 2, AIR_SHADOW = 4, AIR_ROTOR = 6 }
| An aircraft can be one ot those types. More...
## Functions
static bool | IsNormalAircraft (const Vehicle *v)
| Check if the aircraft type is a normal flying device; eg not a rotor or a shadow.
static bool | CanAircraftUseStation (EngineID engine, const Station *st)
| Checks if an aircraft can use the station in question.
static bool | CanAircraftUseStation (EngineID engine, TileIndex tile)
| Checks if an aircraft can use the station at the tile in question.
uint16 | AircraftDefaultCargoCapacity (CargoID cid, const AircraftVehicleInfo *avi)
| Calculates cargo capacity based on an aircraft's passenger and mail capacities.
void | CcBuildAircraft (bool success, TileIndex tile, uint32 p1, uint32 p2)
| This is the Callback method after the construction attempt of an aircraft.
void | HandleAircraftEnterHangar (Vehicle *v)
| Handle Aircraft specific tasks when a an Aircraft enters a hangar.
void | GetAircraftSpriteSize (EngineID engine, uint &width, uint &height)
| Get the size of the sprite of an aircraft sprite heading west (used for lists).
void | UpdateAirplanesOnNewStation (const Station *st)
| Updates the status of the Aircraft heading or in the station.
void | UpdateAircraftCache (Vehicle *v)
| Update cached values of an aircraft.
Station * | GetTargetAirportIfValid (const Vehicle *v)
| Returns aircraft's target station if v->u.air.target_airport is a valid station with airport.

## Detailed Description

Definition in file aircraft.h.

## Enumeration Type Documentation

enum AircraftSubType

An aircraft can be one ot those types.

Enumerator:

  AIR_HELICOPTER | an helicopter
  AIR_AIRCRAFT | an airplane
  AIR_SHADOW | shadow of the aircraft
  AIR_ROTOR | rotor of an helicopter

Definition at line 13 of file aircraft.h.

## Function Documentation

uint16 AircraftDefaultCargoCapacity | ( | CargoID | cid,
|  | const AircraftVehicleInfo * | avi |
| ) |  |  |

Calculates cargo capacity based on an aircraft's passenger and mail capacities.

Parameters:

  | cid | Which cargo type to calculate a capacity for.
  | avi | Which engine to find a cargo capacity for.

Returns:
  New cargo capacity value.

Definition at line 252 of file aircraft_cmd.cpp.

Referenced by CmdBuildAircraft(), and CmdRefitAircraft().

static bool CanAircraftUseStation | ( | EngineID | engine,
|  | TileIndex | tile |
| ) |  |  | `[inline, static]`

Checks if an aircraft can use the station at the tile in question.

Parameters:

  | engine | The engine to test
  | tile | The tile where the station is

Returns:
  true if the aircraft can use the station

Definition at line 53 of file aircraft.h.

References CanAircraftUseStation().

static bool CanAircraftUseStation | ( | EngineID | engine,
|  | const Station * | st |
| ) |  |  | `[inline, static]`

Checks if an aircraft can use the station in question.

Parameters:

  | engine | The engine to test
  | st | The station

Returns:
  true if the aircraft can use the station

Definition at line 40 of file aircraft.h.

References AIR_CTOL.

Referenced by CanAircraftUseStation(), CmdBuildAircraft(), and CmdInsertOrder().

void CcBuildAircraft | ( | bool | success,
|  | TileIndex | tile,
|  | uint32 | p1,
|  | uint32 | p2 |
| ) |  |  |

This is the Callback method after the construction attempt of an aircraft.

Parameters:

  | success | indicates completion (or not) of the operation
  | tile | of depot where aircraft is built
  | p1 | unused
  | p2 | unused

Definition at line 88 of file aircraft_gui.cpp.

References RestoreVehicleOrders(), and ShowVehicleViewWindow().

void GetAircraftSpriteSize | ( | EngineID | engine,
|  | uint & | width,
|  | uint & | height |
| ) |  |  |

Get the size of the sprite of an aircraft sprite heading west (used for lists).

Parameters:

  | engine | The engine to get the sprite from
  | width | The width of the sprite
  | height | The height of the sprite

Definition at line 219 of file aircraft_cmd.cpp.

References DIR_W.

Station* GetTargetAirportIfValid | ( | const Vehicle * | v | ) |

Returns aircraft's target station if v->u.air.target_airport is a valid station with airport.

Parameters:

  | v | vehicle to get target airport for

Returns:
  pointer to target station, NULL if invalid

Definition at line 2207 of file aircraft_cmd.cpp.

Referenced by AircraftNextAirportPos_and_Order(), CmdSendAircraftToHangar(), and MapAircraftMovementState().

void HandleAircraftEnterHangar | ( | Vehicle * | v | ) |

Handle Aircraft specific tasks when a an Aircraft enters a hangar.

Parameters:

  | *v | Vehicle that enters the hangar

Definition at line 868 of file aircraft_cmd.cpp.

static bool IsNormalAircraft | ( | const Vehicle * | v | ) | `[inline, static]`

Check if the aircraft type is a normal flying device; eg not a rotor or a shadow.

Parameters:

  | v | vehicle to check

Returns:
  Returns true if the aircraft is a helicopter/airplane and false if it is a shadow or a rotor)

Definition at line 26 of file aircraft.h.

References AIR_AIRCRAFT.

Referenced by AfterLoadVehicles(), BuildDepotVehicleList(), DrawAircraftDetails(), DrawPlayerVehiclesAmount(), IsEngineCountable(), UpdateAirplanesOnNewStation(), and UpdateOldAircraft().

void UpdateAircraftCache | ( | Vehicle * | v | ) |

Update cached values of an aircraft.

Currently caches callback 36 max speed.

Parameters:

  | v | Vehicle

Definition at line 892 of file aircraft_cmd.cpp.

Referenced by AfterLoadVehicles(), AircraftController(), CmdBuildAircraft(), and UpdateAirplanesOnNewStation().

void UpdateAirplanesOnNewStation | ( | const Station * | st | ) |

Updates the status of the Aircraft heading or in the station.

Parameters:

  | st | Station been updated

Definition at line 2260 of file aircraft_cmd.cpp.

References AIR_HELICOPTER, AircraftGetEntryPoint(), GetAircraftFlyingAltitude(), IsNormalAircraft(), and UpdateAircraftCache().

Referenced by CmdBuildAirport().