13#include "table/strings.h"
28#define AIRPORT_GENERIC(name, terminals, num_helipads, flags, delta_z) \
29 static const AirportFTAClass _airportfta_ ## name(_airport_moving_data_ ## name, terminals, \
30 num_helipads, _airport_entries_ ## name, flags, _airport_fta_ ## name, delta_z);
28#define AIRPORT_GENERIC(name, terminals, num_helipads, flags, delta_z) \ …
38#define AIRPORT(name, num_helipads, short_strip) \
39 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)
38#define AIRPORT(name, num_helipads, short_strip) \ …
47#define HELIPORT(name, num_helipads, delta_z) \
48 AIRPORT_GENERIC(name, nullptr, num_helipads, AirportFTAClass::Flag::Helicopters, delta_z)
47#define HELIPORT(name, num_helipads, delta_z) \ …
57AIRPORT(intercontinental, 2, false)
107 default: NOT_REACHED();
112AirportFTAClass::AirportFTAClass(
114 const uint8_t *terminals_,
115 const uint8_t num_helipads_,
116 const uint8_t *entry_points_,
121 moving_data(moving_data_),
122 terminals(terminals_),
123 num_helipads(num_helipads_),
126 entry_points(entry_points_),
140 uint16_t nofelements = 0;
144 if (temp != apFA[i].position) {
153AirportFTA::AirportFTA(
const AirportFTAbuildup &buildup) : blocks(buildup.blocks), position(buildup.position), next_position(buildup.next), heading(buildup.heading)
165 uint16_t internalcounter = 0;
167 layout.reserve(nofelements);
168 for (uint i = 0; i < nofelements; i++) {
169 AirportFTA *current = &layout.emplace_back(apFA[internalcounter]);
173 current->
next = std::make_unique<AirportFTA>(apFA[internalcounter + 1]);
174 current = current->
next.get();
188 if (airport_type ==
AT_DUMMY)
return &_airportfta_dummy;
205 for (uint i = 0;; i++) {
208 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
Enumeration for the difference between two directions.
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.