OpenTTD Source: src/airport.h File Reference

OpenTTD Source 12.2

Data Structures | Enumerations | Functions | Variables
airport.h File Reference
`#include "direction_type.h"`
`#include "tile_type.h"`

Go to the source code of this file.

## Data Structures
struct | AirportMovingData
| A single location on an airport where aircraft can move to. More...
struct | AirportFTAClass
| Finite sTate mAchine (FTA) of an airport. More...
struct | AirportFTA
| Internal structure used in openttd - Finite sTate mAchine --> FTA. More...

## Enumerations
enum | AirportTypes { AT_SMALL = 0, AT_LARGE = 1, AT_HELIPORT = 2, AT_METROPOLITAN = 3, AT_INTERNATIONAL = 4, AT_COMMUTER = 5, AT_HELIDEPOT = 6, AT_INTERCON = 7, AT_HELISTATION = 8, AT_OILRIG = 9, NEW_AIRPORT_OFFSET = 10, NUM_AIRPORTS_PER_GRF = 128, NUM_AIRPORTS = 128, AT_INVALID = 254, AT_DUMMY = 255 }
| Airport types. More...
enum | AirportMovingDataFlags { AMED_NOSPDCLAMP = 1 << 0, AMED_TAKEOFF = 1 << 1, AMED_SLOWTURN = 1 << 2, AMED_LAND = 1 << 3, AMED_EXACTPOS = 1 << 4, AMED_BRAKE = 1 << 5, AMED_HELI_RAISE = 1 << 6, AMED_HELI_LOWER = 1 << 7, AMED_HOLD = 1 << 8 }
| Flags for airport movement data. More...
enum | AirportMovementStates { TO_ALL = 0, HANGAR = 1, TERM1 = 2, TERM2 = 3, TERM3 = 4, TERM4 = 5, TERM5 = 6, TERM6 = 7, HELIPAD1 = 8, HELIPAD2 = 9, TAKEOFF = 10, STARTTAKEOFF = 11, ENDTAKEOFF = 12, HELITAKEOFF = 13, FLYING = 14, LANDING = 15, ENDLANDING = 16, HELILANDING = 17, HELIENDLANDING = 18, TERM7 = 19, TERM8 = 20, HELIPAD3 = 21, MAX_HEADINGS = 21, TERMGROUP = 255 }
| Movement States on Airports (headings target) More...

## Functions
AirportMovingData | RotateAirportMovingData (const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y)
| Rotate the airport moving data to another rotation. More...
const AirportFTAClass * | GetAirport (const byte airport_type)
| Get the finite state machine of an airport type. More...
byte | GetVehiclePosOnBuild (TileIndex hangar_tile)
| Get the vehicle position when an aircraft is build at the given tile. More...

## Variables
static const uint | MAX_TERMINALS = 8
| Some airport-related constants. More...
static const uint | MAX_HELIPADS = 3
| maximum number of helipads per airport
static const uint | MAX_ELEMENTS = 255
| maximum number of aircraft positions at airport
static const uint | NUM_AIRPORTTILES_PER_GRF = 255
| Number of airport tiles per NewGRF; limited to 255 to allow extending Action3 with an extended byte later on.
static const uint | NUM_AIRPORTTILES = 256
| Total number of airport tiles.
static const uint | NEW_AIRPORTTILE_OFFSET = 74
| offset of first newgrf airport tile
static const uint | INVALID_AIRPORTTILE = NUM_AIRPORTTILES
| id for an invalid airport tile
static const uint64 | TERM1_block = 1ULL << 0
| Movement Blocks on Airports blocks (eg_airport_flags). More...
static const uint64 | TERM2_block = 1ULL << 1
| Block belonging to terminal 2.
static const uint64 | TERM3_block = 1ULL << 2
| Block belonging to terminal 3.
static const uint64 | TERM4_block = 1ULL << 3
| Block belonging to terminal 4.
static const uint64 | TERM5_block = 1ULL << 4
| Block belonging to terminal 5.
static const uint64 | TERM6_block = 1ULL << 5
| Block belonging to terminal 6.
static const uint64 | HELIPAD1_block = 1ULL << 6
| Block belonging to helipad 1.
static const uint64 | HELIPAD2_block = 1ULL << 7
| Block belonging to helipad 2.
static const uint64 | RUNWAY_IN_OUT_block = 1ULL << 8
static const uint64 | RUNWAY_IN_block = 1ULL << 8
static const uint64 | AIRPORT_BUSY_block = 1ULL << 8
static const uint64 | RUNWAY_OUT_block = 1ULL << 9
static const uint64 | TAXIWAY_BUSY_block = 1ULL << 10
static const uint64 | OUT_WAY_block = 1ULL << 11
static const uint64 | IN_WAY_block = 1ULL << 12
static const uint64 | AIRPORT_ENTRANCE_block = 1ULL << 13
static const uint64 | TERM_GROUP1_block = 1ULL << 14
static const uint64 | TERM_GROUP2_block = 1ULL << 15
static const uint64 | HANGAR2_AREA_block = 1ULL << 16
static const uint64 | TERM_GROUP2_ENTER1_block = 1ULL << 17
static const uint64 | TERM_GROUP2_ENTER2_block = 1ULL << 18
static const uint64 | TERM_GROUP2_EXIT1_block = 1ULL << 19
static const uint64 | TERM_GROUP2_EXIT2_block = 1ULL << 20
static const uint64 | PRE_HELIPAD_block = 1ULL << 21
static const uint64 | TERM7_block = 1ULL << 22
| Block belonging to terminal 7.
static const uint64 | TERM8_block = 1ULL << 23
| Block belonging to terminal 8.
static const uint64 | HELIPAD3_block = 1ULL << 24
| Block belonging to helipad 3.
static const uint64 | HANGAR1_AREA_block = 1ULL << 26
static const uint64 | OUT_WAY2_block = 1ULL << 27
static const uint64 | IN_WAY2_block = 1ULL << 28
static const uint64 | RUNWAY_IN2_block = 1ULL << 29
static const uint64 | RUNWAY_OUT2_block = 1ULL << 10
static const uint64 | HELIPAD_GROUP_block = 1ULL << 13
static const uint64 | OUT_WAY_block2 = 1ULL << 31
static const uint64 | NOTHING_block = 1ULL << 30
static const uint64 | AIRPORT_CLOSED_block = 1ULL << 63
| Dummy block for indicating a closed airport.

## Detailed Description

Various declarations for airports

Definition in file airport.h.

## Enumeration Type Documentation

## ◆ AirportMovementStates

enum AirportMovementStates

Movement States on Airports (headings target)

Enumerator
TO_ALL | Go in this direction for every target.
HANGAR | Heading for hangar.
TERM1 | Heading for terminal 1.
TERM2 | Heading for terminal 2.
TERM3 | Heading for terminal 3.
TERM4 | Heading for terminal 4.
TERM5 | Heading for terminal 5.
TERM6 | Heading for terminal 6.
HELIPAD1 | Heading for helipad 1.
HELIPAD2 | Heading for helipad 2.
TAKEOFF | Airplane wants to leave the airport.
STARTTAKEOFF | Airplane has arrived at a runway for take-off.
ENDTAKEOFF | Airplane has reached end-point of the take-off runway.
HELITAKEOFF | Helicopter wants to leave the airport.
FLYING | Vehicle is flying in the air.
LANDING | Airplane wants to land.
ENDLANDING | Airplane wants to finish landing.
HELILANDING | Helicopter wants to land.
HELIENDLANDING | Helicopter wants to finish landing.
TERM7 | Heading for terminal 7.
TERM8 | Heading for terminal 8.
HELIPAD3 | Heading for helipad 3.
MAX_HEADINGS | Last valid target to head for.
TERMGROUP | Aircraft is looking for a free terminal in a terminalgroup.

Definition at line 60 of file airport.h.

## ◆ AirportMovingDataFlags

enum AirportMovingDataFlags

Flags for airport movement data.

Enumerator
AMED_NOSPDCLAMP | No speed restrictions.
AMED_TAKEOFF | Takeoff movement.
AMED_SLOWTURN | Turn slowly (mostly used in the air).
AMED_LAND | Landing onto landing strip.
AMED_EXACTPOS | Go exactly to the destination coordinates.
AMED_BRAKE | Taxiing at the airport.
AMED_HELI_RAISE | Helicopter take-off.
AMED_HELI_LOWER | Helicopter landing.
AMED_HOLD | Holding pattern movement (above the airport).

Definition at line 47 of file airport.h.

## ◆ AirportTypes

enum AirportTypes

Airport types.

Enumerator
AT_SMALL | Small airport.
AT_LARGE | Large airport.
AT_HELIPORT | Heli port.
AT_METROPOLITAN | Metropolitan airport.
AT_INTERNATIONAL | International airport.
AT_COMMUTER | Commuter airport.
AT_HELIDEPOT | Heli depot.
AT_INTERCON | Intercontinental airport.
AT_HELISTATION | Heli station airport.
AT_OILRIG | Oilrig airport.
NEW_AIRPORT_OFFSET | Number of the first newgrf airport.
NUM_AIRPORTS_PER_GRF | Maximal number of airports per NewGRF.
NUM_AIRPORTS | Maximal number of airports in total.
AT_INVALID | Invalid airport.
AT_DUMMY | Dummy airport.

Definition at line 28 of file airport.h.

## Function Documentation

## ◆ GetAirport()

const AirportFTAClass* GetAirport | ( | const byte | airport_type | ) |

Get the finite state machine of an airport type.

Parameters

  airport_type | Airport type to query FTA from.

See also
  AirportTypes

Returns
  Finite state machine of the airport.

Definition at line 207 of file airport.cpp.

References AT_DUMMY, AirportSpec::fsm, and AirportSpec::Get().

Referenced by AircraftController().

## ◆ GetVehiclePosOnBuild()

byte GetVehiclePosOnBuild | ( | TileIndex | hangar_tile | ) |

Get the vehicle position when an aircraft is build at the given tile.

Parameters

  hangar_tile | The tile on which the vehicle is build

Returns
  The position (index in airport node array) where the aircraft ends up

Definition at line 218 of file airport.cpp.

References Station::airport, SpecializedStation< Station, false >::GetByTile(), Airport::GetFTA(), Airport::GetHangarTile(), HANGAR, AirportFTA::heading, AirportFTAClass::layout, and AirportFTA::position.

## ◆ RotateAirportMovingData()

AirportMovingData RotateAirportMovingData | ( | const AirportMovingData * | orig,
|  | Direction | rotation,
|  | uint | num_tiles_x,
|  | uint | num_tiles_y
| ) |  |

Rotate the airport moving data to another rotation.

Parameters

  orig | Pointer to the moving data to rotate.
  rotation | How to rotate the moving data.
  num_tiles_x | Number of tiles in x direction.
  num_tiles_y | Number of tiles in y direction.

Returns
  The rotated moving data.

Definition at line 80 of file airport.cpp.

References ChangeDir(), DIR_E, DIR_N, DIR_S, DIR_W, AirportMovingData::direction, AirportMovingData::flag, TILE_SIZE, AirportMovingData::x, and AirportMovingData::y.

## Variable Documentation

## ◆ HELIPAD_GROUP_block

const uint64 HELIPAD_GROUP_block = 1ULL << 13
| static

Note
  re-uses #AIRPORT_ENTRANCE_block

Definition at line 123 of file airport.h.

## ◆ MAX_TERMINALS

const uint MAX_TERMINALS = 8
| static

Some airport-related constants.

maximum number of terminals per airport

Definition at line 17 of file airport.h.

Referenced by AirportFindFreeHelipad().

## ◆ RUNWAY_OUT2_block

const uint64 RUNWAY_OUT2_block = 1ULL << 10
| static

Note
  re-uses #TAXIWAY_BUSY_block

Definition at line 122 of file airport.h.

## ◆ TERM1_block

const uint64 TERM1_block = 1ULL << 0
| static

Movement Blocks on Airports blocks (eg_airport_flags).

Block belonging to terminal 1.

Definition at line 89 of file airport.h.