14 #include "table/strings.h" 29 #define AIRPORT_GENERIC(name, terminals, num_helipads, flags, delta_z) \ 30 static const AirportFTAClass _airportfta_ ## name(_airport_moving_data_ ## name, terminals, \ 31 num_helipads, _airport_entries_ ## name, flags, _airport_fta_ ## name, delta_z); 39 #define AIRPORT(name, num_helipads, short_strip) \ 40 AIRPORT_GENERIC(name, _airport_terminal_ ## name, num_helipads, AirportFTAClass::ALL | (short_strip ? AirportFTAClass::SHORT_STRIP : (AirportFTAClass::Flags)0), 0) 48 #define HELIPORT(name, num_helipads, delta_z) \ 49 AIRPORT_GENERIC(name, NULL, num_helipads, AirportFTAClass::HELICOPTERS, delta_z) 55 AIRPORT(international, 2, false)
58 AIRPORT(intercontinental, 2, false)
65 #undef AIRPORT_GENERIC 108 default: NOT_REACHED();
113 AirportFTAClass::AirportFTAClass(
115 const byte *terminals_,
116 const byte num_helipads_,
117 const byte *entry_points_,
122 moving_data(moving_data_),
123 terminals(terminals_),
124 num_helipads(num_helipads_),
127 entry_points(entry_points_),
134 AirportFTAClass::~AirportFTAClass()
138 while (current != NULL) {
158 if (temp != apFA[i].position) {
162 if (apFA[i].position == MAX_ELEMENTS)
break;
176 uint16 internalcounter = 0;
191 newNode->
block = apFA[internalcounter + 1].
block;
194 current->
next = newNode;
195 current = current->
next;
198 current->
next = NULL;
211 if (airport_type ==
AT_DUMMY)
return &_airportfta_dummy;
228 for (uint i = 0;; i++) {
byte GetVehiclePosOnBuild(TileIndex hangar_tile)
Get the vehicle position when an aircraft is build at the given tile.
Finite sTate mAchine (FTA) of an airport.
byte nofelements
number of positions the airport consists of
#define AIRPORT(name, num_helipads, short_strip)
Define an airport.
Tables with default values for airports and airport tiles.
const AirportFTAClass * GetAirport(const byte airport_type)
Get the finite state machine of an airport type.
byte next_position
next position from this position
A single location on an airport where aircraft can move to.
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.
int16 y
y-coordinate of the destination.
#define HELIPORT(name, num_helipads, delta_z)
Define a heliport.
const struct AirportFTAClass * fsm
the finite statemachine for the default airports
byte next
Next position from this position.
static const uint TILE_SIZE
Tile size in world coordinates.
Direction
Defines the 8 directions on the map.
#define AIRPORT_GENERIC(name, terminals, num_helipads, flags, delta_z)
Define a generic airport.
Internal structure used in openttd - Finite sTate mAchine –> FTA.
Definition of base types and functions in a cross-platform compatible way.
A number of safeguards to prevent using unsafe methods.
DirDiff
Enumeration for the difference between two directions.
struct AirportFTA * layout
state machine for airport
static const AirportSpec * Get(byte type)
Retrieve airport spec for the given airport.
byte position
The position that an airplane is at.
static Direction ChangeDir(Direction d, DirDiff delta)
Change a direction by a given difference.
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...
TileIndex GetHangarTile(uint hangar_num) const
Get the first tile of the given hangar.
byte heading
The current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.).
static const uint MAX_ELEMENTS
maximum number of aircraft positions at airport
uint32 TileIndex
The index/ID of a Tile.
uint64 block
64 bit blocks (st->airport.flags), should be enough for the most complex airports ...
int16 x
x-coordinate of the destination.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
AirportFTA * next
possible extra movement choices from this position
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
Airport airport
Tile area the airport covers.
AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y)
Rotate the airport moving data to another rotation.
uint16 flag
special flags when moving towards the destination.
Heart of the airports and their finite state machines.
Enum of the default airport tiles.
byte heading
heading (current orders), guiding an airplane to its target on an airport
DirectionByte direction
Direction to turn the aircraft after reaching the destination.
byte position
the position that an airplane is at
Base classes/functions for stations.
uint64 block
The block this position is on on the airport (st->airport.flags).