OpenTTD Source: AirportSpec Struct Reference

OpenTTD Source 1.11.0-RC1

Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Static Private Attributes
AirportSpec Struct Reference

Defines the data structure for an airport. More...

`#include <newgrf_airport.h>`

## Public Member Functions
bool | IsAvailable () const
| Check whether this airport is available to build.
bool | IsWithinMapBounds (byte table, TileIndex index) const
| Check if the airport would be within the map bounds at the given tile. More...
byte | GetIndex () const
| Get the index of this spec.

## Static Public Member Functions
static const AirportSpec * | Get (byte type)
| Retrieve airport spec for the given airport. More...
static AirportSpec * | GetWithoutOverride (byte type)
| Retrieve airport spec for the given airport. More...
static void | ResetAirports ()
| This function initializes the airportspec array.

## Data Fields
const struct AirportFTAClass * | fsm
| the finite statemachine for the default airports
const AirportTileTable *const * | table
| list of the tiles composing the airport
const Direction * | rotation
| the rotation of each tiletable
byte | num_table
| number of elements in the table
const HangarTileTable * | depot_table
| gives the position of the depots on the airports
byte | nof_depots
| the number of hangar tiles in this airport
byte | size_x
| size of airport in x direction
byte | size_y
| size of airport in y direction
byte | noise_level
| noise that this airport generates
byte | catchment
| catchment area of this airport
Year | min_year
| first year the airport is available
Year | max_year
| last year the airport is available
StringID | name
| name of this airport
TTDPAirportType | ttd_airport_type
| ttdpatch airport type (Small/Large/Helipad/Oilrig)
AirportClassID | cls_id
| the class to which this airport type belongs
SpriteID | preview_sprite
| preview sprite for this airport
uint16 | maintenance_cost
| maintenance cost multiplier
bool | enabled
| Entity still available (by default true). Newgrf can disable it, though.
struct GRFFileProps | grf_prop
| Properties related to the grf file.

## Static Public Attributes
static const AirportSpec | dummy = AS_GENERIC(&_airportfta_dummy, nullptr, _default_airports_rotation, 0, nullptr, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR, 0, ATP_TTDP_LARGE, APC_BEGIN, STR_NULL, 0, false)
| The dummy airport.

## Static Private Attributes
static AirportSpec | specs [NUM_AIRPORTS]
| Specs of the airports. More...

## Detailed Description

Defines the data structure for an airport.

Definition at line 98 of file newgrf_airport.h.

## Member Function Documentation

## ◆ Get()

const AirportSpec * AirportSpec::Get | ( | byte | type | ) |
| static

Retrieve airport spec for the given airport.

If an override is available it is returned.

Parameters

  type | index of airport

Returns
  A pointer to the corresponding AirportSpec

Definition at line 99 of file newgrf_airport.cpp.

References enabled, lengthof, NEW_AIRPORT_OFFSET, and specs.

Referenced by AirportResolverObject::AirportResolverObject(), GetAirport(), AirportResolverObject::GetDebugID(), Airport::GetSpec(), and BuildAirportWindow::UpdateWidgetSize().

## ◆ GetWithoutOverride()

AirportSpec * AirportSpec::GetWithoutOverride | ( | byte | type | ) |
| static

Retrieve airport spec for the given airport.

Even if an override is available the base spec is returned.

Parameters

  type | index of airport

Returns
  A pointer to the corresponding AirportSpec

Definition at line 119 of file newgrf_airport.cpp.

References lengthof, and specs.

Referenced by BindAirportSpecs().

## ◆ IsWithinMapBounds()

bool AirportSpec::IsWithinMapBounds | ( | byte | table,
|  | TileIndex | tile
| ) |  | const

Check if the airport would be within the map bounds at the given tile.

Parameters

  table | Selected layout table. This affects airport rotation, and therefore dimensions.
  tile | Top corner of the airport.

Returns
  true iff the airport would be within the map bounds at the given tile.

Definition at line 140 of file newgrf_airport.cpp.

References DIR_E, DIR_W, MapSizeX(), MapSizeY(), num_table, rotation, size_x, size_y, Swap(), table, TileX(), and TileY().

## Field Documentation

## ◆ specs

AirportSpec AirportSpec::specs
| staticprivate

Specs of the airports.

Airport specifications.

Definition at line 138 of file newgrf_airport.h.

Referenced by Get(), GetIndex(), and GetWithoutOverride().

The documentation for this struct was generated from the following files:

- src/newgrf_airport.h
- src/newgrf_airport.cpp
- src/table/airport_defaults.h