12#include "table/strings.h"
27#define AIRPORT_GENERIC(name, terminals, num_helipads, flags, delta_z) \
28 static const AirportFTAClass _airportfta_ ## name(_airport_moving_data_ ## name, terminals, \
29 num_helipads, _airport_entries_ ## name, flags, _airport_fta_ ## name, delta_z);
37#define AIRPORT(name, num_helipads, short_strip) \
38 AIRPORT_GENERIC(name, _airport_terminal_ ## name, num_helipads, AirportFTAClass::Flags({AirportFTAClass::Flag::Airplanes, AirportFTAClass::Flag::Helicopters}) | (short_strip ? AirportFTAClass::Flags{AirportFTAClass::Flag::ShortStrip} : AirportFTAClass::Flags{}), 0)
46#define HELIPORT(name, num_helipads, delta_z) \
47 AIRPORT_GENERIC(name, nullptr, num_helipads, AirportFTAClass::Flag::Helicopters, delta_z)
56AIRPORT(intercontinental, 2, false)
106 default: NOT_REACHED();
111AirportFTAClass::AirportFTAClass(
113 const uint8_t *terminals_,
114 const uint8_t num_helipads_,
115 const uint8_t *entry_points_,
120 moving_data(moving_data_),
121 terminals(terminals_),
122 num_helipads(num_helipads_),
125 entry_points(entry_points_),
139 uint16_t nofelements = 0;
143 if (temp != apFA[i].position) {
152AirportFTA::AirportFTA(
const AirportFTAbuildup &buildup) : blocks(buildup.blocks), position(buildup.position), next_position(buildup.next), heading(buildup.heading)
164 uint16_t internalcounter = 0;
166 layout.reserve(nofelements);
167 for (uint i = 0; i < nofelements; i++) {
168 AirportFTA *current = &layout.emplace_back(apFA[internalcounter]);
172 current->
next = std::make_unique<AirportFTA>(apFA[internalcounter + 1]);
173 current = current->
next.get();
187 if (airport_type ==
AT_DUMMY)
return &_airportfta_dummy;
204 for (uint i = 0;; i++) {
207 return apc->
layout[i].position;
#define AIRPORT(name, num_helipads, short_strip)
Define an airport.
#define AIRPORT_GENERIC(name, terminals, num_helipads, flags, delta_z)
Define a generic airport.
static uint16_t AirportGetNofElements(const AirportFTAbuildup *apFA)
Get the number of elements of a source Airport state automata Since it is actually just a big array o...
uint8_t GetVehiclePosOnBuild(TileIndex hangar_tile)
Get the vehicle position when an aircraft is build at the given tile.
const AirportFTAClass * GetAirport(const uint8_t airport_type)
Get the finite state machine of an airport type.
AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y)
Rotate the airport moving data to another rotation.
#define HELIPORT(name, num_helipads, delta_z)
Define a heliport.
static void AirportBuildAutomata(std::vector< AirportFTA > &layout, uint8_t nofelements, const AirportFTAbuildup *apFA)
Construct the FTA given a description.
static const uint MAX_ELEMENTS
maximum number of aircraft positions at airport
@ HANGAR
Heading for hangar.
Tables with default values for airports and airport tiles.
Heart of the airports and their finite state machines.
Enum of the default airport tiles.
Direction ChangeDir(Direction d, DirDiff delta)
Change a direction by a given difference.
DirDiff
Allow incrementing of Direction variables.
Direction
Defines the 8 directions on the map.
A number of safeguards to prevent using unsafe methods.
Base classes/functions for stations.
Definition of base types and functions in a cross-platform compatible way.
Finite sTate mAchine (FTA) of an airport.
@ Airplanes
Can planes land on this airport type?
@ Helicopters
Can helicopters land on this airport type?
std::vector< AirportFTA > layout
state machine for airport
Internal structure used in openttd - Finite sTate mAchine --> FTA.
std::unique_ptr< AirportFTA > next
possible extra movement choices from this position
uint8_t position
the position that an airplane is at
State machine input struct (from external file, etc.) Finite sTate mAchine --> FTA.
uint8_t position
The position that an airplane is at.
A single location on an airport where aircraft can move to.
int16_t x
x-coordinate of the destination.
AirportMovingDataFlags flags
special flags when moving towards the destination.
int16_t y
y-coordinate of the destination.
Direction direction
Direction to turn the aircraft after reaching the destination.
const struct AirportFTAClass * fsm
the finite statemachine for the default airports
static const AirportSpec * Get(uint8_t type)
Retrieve airport spec for the given airport.
const AirportFTAClass * GetFTA() const
Get the finite-state machine for this airport or the finite-state machine for the dummy airport in ca...
TileIndex GetHangarTile(uint hangar_num) const
Get the first tile of the given hangar.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
Airport airport
Tile area the airport covers.
static const uint TILE_SIZE
Tile size in world coordinates.