|
OpenTTD Source
14.0-beta3
|
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_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++) {
byte heading
heading (current orders), guiding an airplane to its target on an airport
#define AIRPORT(name, num_helipads, short_strip)
Define an airport.
Direction
Defines the 8 directions on the map.
A single location on an airport where aircraft can move to.
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.
Direction ChangeDir(Direction d, DirDiff delta)
Change a direction by a given difference.
@ HANGAR
Heading for hangar.
const AirportFTAClass * GetAirport(const byte airport_type)
Get the finite state machine of an airport type.
int16_t x
x-coordinate of the destination.
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.
int16_t y
y-coordinate of the destination.
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
byte heading
The current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.).
byte nofelements
number of positions the airport consists of
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...
void free(const void *ptr)
Version of the standard free that accepts const pointers.
uint64_t block
The block this position is on on the airport (st->airport.flags).
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.
uint64_t block
64 bit blocks (st->airport.flags), should be enough for the most complex airports
#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
Allow incrementing of Direction variables.
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.
byte next
Next position from this position.
#define HELIPORT(name, num_helipads, delta_z)
Define a heliport.
byte position
the position that an airplane is at
byte next_position
next position from this position
uint16_t flag
special flags when moving towards the destination.