OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
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 byte *terminals_,
114 const byte num_helipads_,
115 const byte *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 nofelements = 0;
156 if (temp != apFA[i].position) {
173 AirportFTA *FAutomata = MallocT<AirportFTA>(nofelements);
174 uint16 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++) {
byte heading
heading (current orders), guiding an airplane to its target on an airport
#define AIRPORT(name, num_helipads, short_strip)
Define an airport.
uint32 TileIndex
The index/ID of a Tile.
Direction
Defines the 8 directions on the map.
A single location on an airport where aircraft can move to.
static Direction ChangeDir(Direction d, DirDiff delta)
Change a direction by a given difference.
AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y)
Rotate the airport moving data to another rotation.
byte position
The position that an airplane is at.
static const uint TILE_SIZE
Tile size in world coordinates.
@ HANGAR
Heading for hangar.
const AirportFTAClass * GetAirport(const byte airport_type)
Get the finite state machine of an airport type.
Direction direction
Direction to turn the aircraft after reaching the destination.
const AirportFTAClass * GetFTA() const
Get the finite-state machine for this airport or the finite-state machine for the dummy airport in ca...
static AirportFTA * AirportBuildAutomata(uint nofelements, const AirportFTAbuildup *apFA)
Construct the FTA given a description.
State machine input struct (from external file, etc.) Finite sTate mAchine --> FTA.
static const AirportSpec * Get(byte type)
Retrieve airport spec for the given airport.
const struct AirportFTAClass * fsm
the finite statemachine for the default airports
uint16 flag
special flags when moving towards the destination.
byte heading
The current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.).
byte nofelements
number of positions the airport consists of
TileIndex GetHangarTile(uint hangar_num) const
Get the first tile of the given hangar.
Airport airport
Tile area the airport covers.
struct AirportFTA * layout
state machine for airport
Internal structure used in openttd - Finite sTate mAchine --> FTA.
#define AIRPORT_GENERIC(name, terminals, num_helipads, flags, delta_z)
Define a generic airport.
Finite sTate mAchine (FTA) of an airport.
byte GetVehiclePosOnBuild(TileIndex hangar_tile)
Get the vehicle position when an aircraft is build at the given tile.
DirDiff
Enumeration for the difference between two directions.
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 o...
uint64 block
The block this position is on on the airport (st->airport.flags).
int16 x
x-coordinate of the destination.
AirportFTA * next
possible extra movement choices from this position
static const uint MAX_ELEMENTS
maximum number of aircraft positions at airport
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
int16 y
y-coordinate of the destination.
byte next
Next position from this position.
uint64 block
64 bit blocks (st->airport.flags), should be enough for the most complex airports
#define HELIPORT(name, num_helipads, delta_z)
Define a heliport.
byte position
the position that an airplane is at
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
byte next_position
next position from this position