# airport.cpp File Reference

Functions related to airports. More...

`#include "stdafx.h"`
`#include "debug.h"`
`#include "airport.h"`
`#include "airport_movement.h"`
`#include "core/alloc_func.hpp"`
`#include "date_func.h"`
`#include "settings_type.h"`

Go to the source code of this file.

## Enumerations

enum

AirportTiles {
APT_APRON = 0, APT_APRON_FENCE_NW = 1, APT_APRON_FENCE_SW = 2, APT_STAND = 3,
APT_APRON_W = 4, APT_APRON_S = 5, APT_APRON_VER_CROSSING_S = 6, APT_APRON_HOR_CROSSING_W = 7,
APT_APRON_VER_CROSSING_N = 8, APT_APRON_HOR_CROSSING_E = 9, APT_APRON_E = 10, APT_ARPON_N = 11,
APT_APRON_HOR = 12, APT_APRON_N_FENCE_SW = 13, APT_RUNWAY_1 = 14, APT_RUNWAY_2 = 15,
APT_RUNWAY_3 = 16, APT_RUNWAY_4 = 17, APT_RUNWAY_END_FENCE_SE = 18, APT_BUILDING_2 = 19,
APT_TOWER_FENCE_SW = 20, APT_ROUND_TERMINAL = 21, APT_BUILDING_3 = 22, APT_BUILDING_1 = 23,
APT_DEPOT_SE = 24, APT_STAND_1 = 25, APT_STAND_PIER_NE = 26, APT_PIER_NW_NE = 27,
APT_PIER = 28, APT_EMPTY = 29, APT_EMPTY_FENCE_NE = 30, APT_RADAR_GRASS_FENCE_SW = 31,
APT_RADIO_TOWER_FENCE_NE = 43, APT_SMALL_BUILDING_3 = 44, APT_SMALL_BUILDING_2 = 45, APT_SMALL_BUILDING_1 = 46,
APT_GRASS_FENCE_SW = 47, APT_GRASS_2 = 48, APT_GRASS_1 = 49, APT_GRASS_FENCE_NE_FLAG = 50,
APT_RUNWAY_SMALL_NEAR_END = 54, APT_RUNWAY_SMALL_MIDDLE = 55, APT_RUNWAY_SMALL_FAR_END = 56, APT_SMALL_DEPOT_SE = 57,
APT_HELIPORT = 58, APT_RUNWAY_END = 59, APT_RUNWAY_5 = 60, APT_TOWER = 61,
APT_SMALL_DEPOT_SE_2 = 62, APT_APRON_FENCE_NE = 63, APT_RUNWAY_END_FENCE_NW = 64, APT_RUNWAY_FENCE_NW = 65,
APT_RADAR_FENCE_SW = 66, APT_RADAR_FENCE_NE = 78, APT_HELIPAD_1 = 90, APT_HELIPAD_2_FENCE_NW = 91,
APT_HELIPAD_2 = 92, APT_APRON_FENCE_NE_SW = 93, APT_RUNWAY_END_FENCE_NW_SW = 94, APT_RUNWAY_END_FENCE_SE_SW = 95,
APT_RUNWAY_END_FENCE_NE_NW = 96, APT_RUNWAY_END_FENCE_NE_SE = 97, APT_HELIPAD_2_FENCE_NE_SE = 98, APT_APRON_FENCE_SE_SW = 99,
APT_LOW_BUILDING_FENCE_N = 100, APT_ROT_RUNWAY_FENCE_NE = 101, APT_ROT_RUNWAY_END_FENCE_NE = 102, APT_ROT_RUNWAY_FENCE_SW = 103,
APT_ROT_RUNWAY_END_FENCE_SW = 104, APT_DEPOT_SW = 105, APT_DEPOT_NW = 106, APT_DEPOT_NE = 107,
APT_HELIPAD_2_FENCE_SE_SW = 108, APT_HELIPAD_2_FENCE_SE = 109, APT_LOW_BUILDING_FENCE_NW = 110, APT_LOW_BUILDING_FENCE_NE = 111,
APT_LOW_BUILDING_FENCE_SW = 112, APT_LOW_BUILDING_FENCE_SE = 113, APT_STAND_FENCE_NE = 114, APT_STAND_FENCE_SE = 115,
APT_STAND_FENCE_SW = 116, APT_APRON_FENCE_NE_2 = 117, APT_APRON_FENCE_SE = 118, APT_HELIPAD_2_FENCE_NW_SW = 119,
APT_HELIPAD_2_FENCE_SW = 120, APT_RADAR_FENCE_SE = 121, APT_HELIPAD_3_FENCE_SE_SW = 133, APT_HELIPAD_3_FENCE_NW_SW = 134,
APT_HELIPAD_3_FENCE_NW = 135, APT_LOW_BUILDING = 136, APT_APRON_FENCE_NE_SE = 137, APT_APRON_HALF_EAST = 138,
APT_APRON_HALF_WEST = 139, APT_GRASS_FENCE_NE_FLAG_2 = 140
}

## Functions

| assert_compile (NUM_AIRPORTS==lengthof(_airport_sections))
void | InitializeAirports ()
void | UnInitializeAirports ()
static uint16 | AirportGetNofElements (const AirportFTAbuildup *apFA)
| Get the number of elements of a source Airport state automata Since it is actually just a big array of AirportFTA types, we only know one element from the other by differing 'position' identifiers.
static AirportFTA * | AirportBuildAutomata (uint nofelements, const AirportFTAbuildup *apFA)
static byte | AirportGetTerminalCount (const byte *terminals, byte *groups)
| We calculate the terminal/helipod count based on the data passed to us This data (terminals) contains an index as a first element as to how many groups there are, and then the number of terminals for each group.
static byte | AirportTestFTA (uint nofelements, const AirportFTA *layout, const byte *terminals)
const AirportFTAClass * | GetAirport (const byte airport_type)

## Variables

static const byte | _airport_sections_country []
| Tiles for Country Airfield (small).
static const byte | _airport_sections_town []
| Tiles for City Airport (large).
static const byte | _airport_sections_metropolitan []
| Tiles for Metropolitain Airport (large) - 2 runways.
static const byte | _airport_sections_international []
| Tiles for International Airport (large) - 2 runways.
static const byte | _airport_sections_intercontinental []
| Tiles for Intercontinental Airport (vlarge) - 4 runways.
static const byte | _airport_sections_commuter []
| Tiles for Commuter Airfield (small).
static const byte | _airport_sections_heliport []
| Tiles for Heliport.
static const byte | _airport_sections_helidepot []
| Tiles for Helidepot.
static const byte | _airport_sections_helistation []
| Tiles for Helistation.
const byte *const | _airport_sections []
static AirportFTAClass * | _dummy_airport
static AirportFTAClass * | _country_airport
static AirportFTAClass * | _city_airport
static AirportFTAClass * | _oilrig
static AirportFTAClass * | _heliport
static AirportFTAClass * | _metropolitan_airport
static AirportFTAClass * | _international_airport
static AirportFTAClass * | _commuter_airport
static AirportFTAClass * | _heli_depot
static AirportFTAClass * | _intercontinental_airport
static AirportFTAClass * | _heli_station

## Detailed Description

Functions related to airports.

Definition in file airport.cpp.

## Variable Documentation

const byte* const _airport_sections[]

Initial value:

     {
      _airport_sections_country,
      _airport_sections_town,
      _airport_sections_heliport,
      _airport_sections_metropolitan,
      _airport_sections_international,
      _airport_sections_commuter,
      _airport_sections_helidepot,
      _airport_sections_intercontinental,
      _airport_sections_helistation,
    }

Definition at line 204 of file airport.cpp.

const byte _airport_sections_commuter[]`[static]`

Initial value:

     {
      APT_TOWER,               APT_BUILDING_3, APT_HELIPAD_2_FENCE_NW, APT_HELIPAD_2_FENCE_NW, APT_DEPOT_SE,
      APT_APRON_FENCE_NE,      APT_APRON,      APT_APRON,              APT_APRON,              APT_APRON_FENCE_SW,
      APT_APRON_FENCE_NE,      APT_STAND,      APT_STAND,              APT_STAND,              APT_APRON_FENCE_SW,
      APT_RUNWAY_END_FENCE_SE, APT_RUNWAY_2,   APT_RUNWAY_2,           APT_RUNWAY_2,           APT_RUNWAY_END_FENCE_SE
    }

Tiles for Commuter Airfield (small).

Definition at line 180 of file airport.cpp.

const byte _airport_sections_country[]`[static]`

Initial value:

     {
      APT_SMALL_BUILDING_1,     APT_SMALL_BUILDING_2,    APT_SMALL_BUILDING_3,    APT_SMALL_DEPOT_SE,
      APT_GRASS_FENCE_NE_FLAG,  APT_GRASS_1,             APT_GRASS_2,             APT_GRASS_FENCE_SW,
      APT_RUNWAY_SMALL_FAR_END, APT_RUNWAY_SMALL_MIDDLE, APT_RUNWAY_SMALL_MIDDLE, APT_RUNWAY_SMALL_NEAR_END
    }

Tiles for Country Airfield (small).

Definition at line 126 of file airport.cpp.

const byte _airport_sections_helidepot[]`[static]`

Initial value:

     {
      APT_LOW_BUILDING_FENCE_N,  APT_DEPOT_SE,
      APT_HELIPAD_2_FENCE_NE_SE, APT_APRON_FENCE_SE_SW
    }

Tiles for Helidepot.

Definition at line 193 of file airport.cpp.

const byte _airport_sections_heliport[]`[static]`

Initial value:

     {
      APT_HELIPORT,
    }

Tiles for Heliport.

Definition at line 188 of file airport.cpp.

const byte _airport_sections_helistation[]`[static]`

Initial value:

     {
      APT_DEPOT_SE,          APT_LOW_BUILDING_FENCE_NW, APT_HELIPAD_3_FENCE_NW, APT_HELIPAD_3_FENCE_NW_SW,
      APT_APRON_FENCE_NE_SE, APT_APRON_FENCE_SE,        APT_APRON_FENCE_SE,     APT_HELIPAD_3_FENCE_SE_SW
    }

Tiles for Helistation.

Definition at line 199 of file airport.cpp.

const byte _airport_sections_intercontinental[]`[static]`

Initial value:

     {
      APT_RADAR_FENCE_NE,         APT_RUNWAY_END_FENCE_NE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW,        APT_RUNWAY_END_FENCE_NW_SW,
      APT_RUNWAY_END_FENCE_NE_NW, APT_RUNWAY_2,               APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_END_FENCE_SE_SW, APT_APRON_FENCE_NE_SW,
      APT_APRON_FENCE_NE,         APT_SMALL_BUILDING_1,       APT_APRON_FENCE_NE,  APT_APRON,           APT_APRON,           APT_APRON,           APT_APRON,           APT_RADIO_TOWER_FENCE_NE,   APT_APRON_FENCE_NE_SW,
      APT_APRON_FENCE_NE,         APT_APRON_HALF_EAST,        APT_APRON_FENCE_NE,  APT_TOWER,           APT_HELIPAD_2,       APT_HELIPAD_2,       APT_APRON,           APT_APRON_FENCE_NW,         APT_APRON_FENCE_SW,
      APT_APRON_FENCE_NE,         APT_APRON,                  APT_APRON,           APT_STAND,           APT_BUILDING_1,      APT_STAND,           APT_APRON,           APT_LOW_BUILDING,           APT_DEPOT_SE,
      APT_DEPOT_SE,               APT_LOW_BUILDING,           APT_APRON,           APT_STAND,           APT_BUILDING_2,      APT_STAND,           APT_APRON,           APT_APRON,                  APT_APRON_FENCE_SW,
      APT_APRON_FENCE_NE,         APT_APRON,                  APT_APRON,           APT_STAND,           APT_BUILDING_3,      APT_STAND,           APT_APRON,           APT_APRON,                  APT_APRON_FENCE_SW,
      APT_APRON_FENCE_NE,         APT_APRON_FENCE_SE,         APT_APRON,           APT_STAND,           APT_ROUND_TERMINAL,  APT_STAND,           APT_APRON_FENCE_SW,  APT_APRON_HALF_WEST,        APT_APRON_FENCE_SW,
      APT_APRON_FENCE_NE,         APT_GRASS_FENCE_NE_FLAG_2,  APT_APRON_FENCE_NE,  APT_APRON,           APT_APRON,           APT_APRON,           APT_APRON_FENCE_SW,  APT_EMPTY,                  APT_APRON_FENCE_NE_SW,
      APT_APRON_FENCE_NE,         APT_RUNWAY_END_FENCE_NE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW,        APT_RUNWAY_END_FENCE_SE_SW,
      APT_RUNWAY_END_FENCE_NE_SE, APT_RUNWAY_2,               APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_END_FENCE_SE_SW, APT_EMPTY
    }

Tiles for Intercontinental Airport (vlarge) - 4 runways.

Definition at line 164 of file airport.cpp.

const byte _airport_sections_international[]`[static]`

Initial value:

     {
      APT_RUNWAY_END_FENCE_NW,  APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_END_FENCE_NW,
      APT_RADIO_TOWER_FENCE_NE, APT_APRON,           APT_APRON,           APT_APRON,           APT_APRON,           APT_APRON,           APT_DEPOT_SE,
      APT_BUILDING_3,           APT_APRON,           APT_STAND,           APT_BUILDING_2,      APT_STAND,           APT_APRON,           APT_APRON_FENCE_SW,
      APT_DEPOT_SE,             APT_APRON,           APT_STAND,           APT_BUILDING_2,      APT_STAND,           APT_APRON,           APT_HELIPAD_1,
      APT_APRON_FENCE_NE,       APT_APRON,           APT_STAND,           APT_TOWER,           APT_STAND,           APT_APRON,           APT_HELIPAD_1,
      APT_APRON_FENCE_NE,       APT_APRON,           APT_APRON,           APT_APRON,           APT_APRON,           APT_APRON,           APT_RADAR_FENCE_SW,
      APT_RUNWAY_END_FENCE_SE,  APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_2,        APT_RUNWAY_END_FENCE_SE
    }

Tiles for International Airport (large) - 2 runways.

Definition at line 153 of file airport.cpp.

const byte _airport_sections_metropolitan[]`[static]`

Initial value:

     {
      APT_BUILDING_1,           APT_APRON_FENCE_NW, APT_STAND_1,        APT_APRON_FENCE_NW, APT_APRON_FENCE_NW, APT_DEPOT_SE,
      APT_BUILDING_2,           APT_PIER,           APT_ROUND_TERMINAL, APT_STAND_PIER_NE,  APT_APRON,          APT_APRON_FENCE_SW,
      APT_BUILDING_3,           APT_STAND,          APT_PIER_NW_NE,     APT_APRON_S,        APT_APRON_HOR,      APT_APRON_N_FENCE_SW,
      APT_RADAR_FENCE_NE,       APT_APRON,          APT_APRON,          APT_APRON,          APT_APRON,          APT_TOWER_FENCE_SW,
      APT_RUNWAY_END,           APT_RUNWAY_5,       APT_RUNWAY_5,       APT_RUNWAY_5,       APT_RUNWAY_5,       APT_RUNWAY_END,
      APT_RUNWAY_END_FENCE_SE,  APT_RUNWAY_2,       APT_RUNWAY_2,       APT_RUNWAY_2,       APT_RUNWAY_2,       APT_RUNWAY_END_FENCE_SE
    }

Tiles for Metropolitain Airport (large) - 2 runways.

Definition at line 143 of file airport.cpp.

const byte _airport_sections_town[]`[static]`

Initial value:

     {
      APT_BUILDING_1,           APT_APRON_FENCE_NW, APT_STAND_1,              APT_APRON_FENCE_NW,       APT_APRON_FENCE_NW, APT_DEPOT_SE,
      APT_BUILDING_2,           APT_PIER,           APT_ROUND_TERMINAL,       APT_STAND_PIER_NE,        APT_APRON,          APT_APRON_FENCE_SW,
      APT_BUILDING_3,           APT_STAND,          APT_PIER_NW_NE,           APT_APRON_S,              APT_APRON_HOR,      APT_APRON_N_FENCE_SW,
      APT_RADIO_TOWER_FENCE_NE, APT_APRON_W,        APT_APRON_VER_CROSSING_S, APT_APRON_HOR_CROSSING_E, APT_ARPON_N,        APT_TOWER_FENCE_SW,
      APT_EMPTY_FENCE_NE,       APT_APRON_S,        APT_APRON_HOR_CROSSING_W, APT_APRON_VER_CROSSING_N, APT_APRON_E,        APT_RADAR_GRASS_FENCE_SW,
      APT_RUNWAY_END_FENCE_SE,  APT_RUNWAY_1,       APT_RUNWAY_2,             APT_RUNWAY_3,             APT_RUNWAY_4,       APT_RUNWAY_END_FENCE_SE
    }

Tiles for City Airport (large).

Definition at line 133 of file airport.cpp.