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::ALL | (short_strip ? AirportFTAClass::SHORT_STRIP : (AirportFTAClass::Flags)0), 0)
46 #define HELIPORT(name, num_helipads, delta_z) \
47 AIRPORT_GENERIC(name, nullptr, num_helipads, AirportFTAClass::HELICOPTERS, delta_z)
53 AIRPORT(international, 2, false)
56 AIRPORT(intercontinental, 2, false)
63 #undef AIRPORT_GENERIC
106 default: NOT_REACHED();
111 AirportFTAClass::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_),
132 AirportFTAClass::~AirportFTAClass()
136 while (current !=
nullptr) {
152 uint16_t nofelements = 0;
156 if (temp != apFA[i].position) {
173 AirportFTA *FAutomata = MallocT<AirportFTA>(nofelements);
174 uint16_t internalcounter = 0;
176 for (uint i = 0; i < nofelements; i++) {
189 newNode->
block = apFA[internalcounter + 1].
block;
192 current->
next = newNode;
193 current = current->
next;
196 current->
next =
nullptr;
209 if (airport_type ==
AT_DUMMY)
return &_airportfta_dummy;
226 for (uint i = 0;; i++) {
#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...
const AirportFTAClass * GetAirport(const uint8_t airport_type)
Get the finite state machine of an airport type.
uint8_t GetVehiclePosOnBuild(TileIndex hangar_tile)
Get the vehicle position when an aircraft is build at the given tile.
AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y)
Rotate the airport moving data to another rotation.
static AirportFTA * AirportBuildAutomata(uint nofelements, const AirportFTAbuildup *apFA)
Construct the FTA given a description.
#define HELIPORT(name, num_helipads, delta_z)
Define a heliport.
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.
Direction
Defines the 8 directions on the map.
DirDiff
Allow incrementing of Direction variables.
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.
void free(const void *ptr)
Version of the standard free that accepts const pointers.
Finite sTate mAchine (FTA) of an airport.
struct AirportFTA * layout
state machine for airport
uint8_t nofelements
number of positions the airport consists of
Internal structure used in openttd - Finite sTate mAchine --> FTA.
AirportFTA * next
possible extra movement choices from this position
uint8_t heading
heading (current orders), guiding an airplane to its target on an airport
uint64_t block
64 bit blocks (st->airport.flags), should be enough for the most complex airports
uint8_t position
the position that an airplane is at
uint8_t next_position
next position from this position
State machine input struct (from external file, etc.) Finite sTate mAchine --> FTA.
uint8_t heading
The current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.).
uint8_t next
Next position from this position.
uint8_t position
The position that an airplane is at.
uint64_t block
The block this position is on on the airport (st->airport.flags).
A single location on an airport where aircraft can move to.
uint16_t flag
special flags when moving towards the destination.
int16_t x
x-coordinate of 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 Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
Airport airport
Tile area the airport covers.
static const uint TILE_SIZE
Tile size in world coordinates.