OpenTTD Source 20241224-master-gf74b0cf984
|
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 (uint8_t table, TileIndex index) const |
Check if the airport would be within the map bounds at the given tile. | |
uint8_t | GetIndex () const |
Get the index of this spec. | |
Static Public Member Functions | |
static const AirportSpec * | Get (uint8_t type) |
Retrieve airport spec for the given airport. | |
static AirportSpec * | GetWithoutOverride (uint8_t type) |
Retrieve airport spec for the given airport. | |
static void | ResetAirports () |
This function initializes the airportspec array. | |
Data Fields | |
const struct AirportFTAClass * | fsm |
the finite statemachine for the default airports | |
std::vector< AirportTileLayout > | layouts |
List of layouts composing the airport. | |
std::span< const HangarTileTable > | depots |
Position of the depots on the airports. | |
uint8_t | size_x |
size of airport in x direction | |
uint8_t | size_y |
size of airport in y direction | |
uint8_t | noise_level |
noise that this airport generates | |
uint8_t | catchment |
catchment area of this airport | |
TimerGameCalendar::Year | min_year |
first year the airport is available | |
TimerGameCalendar::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) | |
SpriteID | preview_sprite |
preview sprite for this airport | |
uint16_t | 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. | |
Data Fields inherited from NewGRFSpecBase< AirportClassID > | |
AirportClassID | class_index |
Class index of this spec, invalid until class is allocated. | |
uint16_t | index |
Index within class of this spec, invalid until inserted into class. | |
Static Public Attributes | |
static const AirportSpec | dummy = AS_GENERIC(&_airportfta_dummy, {}, {}, 0, 0, 0, 0, CalendarTime::MIN_YEAR, CalendarTime::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. | |
Defines the data structure for an airport.
Definition at line 105 of file newgrf_airport.h.
|
static |
Retrieve airport spec for the given airport.
If an override is available it is returned.
type | index of airport |
Definition at line 55 of file newgrf_airport.cpp.
References AT_INVALID, enabled, OverrideManagerBase::GetGRFID(), OverrideManagerBase::GetSubstituteID(), grf_prop, lengthof, NEW_AIRPORT_OFFSET, GRFFileProps::override, and specs.
Referenced by CmdBuildAirport(), GetAirport(), NIHAirport::GetGRFID(), Airport::GetSpec(), NIHAirport::GetSpec(), NIHAirport::IsInspectable(), NIHAirport::Resolve(), and BuildAirportWindow::UpdateWidgetSize().
|
inline |
|
static |
Retrieve airport spec for the given airport.
Even if an override is available the base spec is returned.
type | index of airport |
Definition at line 75 of file newgrf_airport.cpp.
References lengthof, and specs.
Referenced by AirportChangeInfo(), and BindAirportSpecs().
bool AirportSpec::IsAvailable | ( | ) | const |
Check whether this airport is available to build.
Definition at line 82 of file newgrf_airport.cpp.
References _settings_game, enabled, max_year, min_year, StationSettings::never_expire_airports, GameSettings::station, and TimerGameCalendar::year.
Referenced by CmdBuildAirport().
bool AirportSpec::IsWithinMapBounds | ( | uint8_t | table, |
TileIndex | tile | ||
) | const |
Check if the airport would be within the map bounds at the given tile.
table | Selected layout table. This affects airport rotation, and therefore dimensions. |
tile | Top corner of the airport. |
Definition at line 96 of file newgrf_airport.cpp.
References DIR_E, DIR_W, layouts, size_x, size_y, Map::SizeX(), Map::SizeY(), Swap(), TileX(), and TileY().
Referenced by CmdBuildAirport().
|
static |
This function initializes the airportspec array.
Definition at line 111 of file newgrf_airport.cpp.
References NEW_AIRPORT_OFFSET, OverrideManagerBase::ResetOverride(), and specs.
Referenced by ResetNewGRFData().
uint8_t AirportSpec::catchment |
catchment area of this airport
Definition at line 112 of file newgrf_airport.h.
Referenced by Station::GetCatchmentRadius(), and GetTileCatchmentRadius().
std::span<const HangarTileTable> AirportSpec::depots |
Position of the depots on the airports.
Definition at line 108 of file newgrf_airport.h.
Referenced by Airport::GetHangarDataByTile(), Airport::GetHangarTile(), Airport::GetNumHangars(), Airport::HasHangar(), and IsHangar().
|
static |
The dummy airport.
Definition at line 138 of file newgrf_airport.h.
Referenced by Airport::GetSpec().
bool AirportSpec::enabled |
Entity still available (by default true). Newgrf can disable it, though.
Definition at line 120 of file newgrf_airport.h.
Referenced by AirportChangeInfo(), BindAirportSpecs(), FinaliseAirportsArray(), Get(), and IsAvailable().
const struct AirportFTAClass* AirportSpec::fsm |
the finite statemachine for the default airports
Definition at line 106 of file newgrf_airport.h.
Referenced by GetAirport(), and Airport::GetFTA().
struct GRFFileProps AirportSpec::grf_prop |
Properties related to the grf file.
Definition at line 121 of file newgrf_airport.h.
Referenced by AirportResolverObject::AirportResolverObject(), Get(), GetAirportTextCallback(), AirportResolverObject::GetDebugID(), NIHAirport::GetGRFID(), and NIHAirport::IsInspectable().
std::vector<AirportTileLayout> AirportSpec::layouts |
List of layouts composing the airport.
Definition at line 107 of file newgrf_airport.h.
Referenced by CmdBuildAirport(), Airport::GetHangarExitDirection(), and IsWithinMapBounds().
uint16_t AirportSpec::maintenance_cost |
maintenance cost multiplier
Definition at line 118 of file newgrf_airport.h.
TimerGameCalendar::Year AirportSpec::max_year |
last year the airport is available
Definition at line 114 of file newgrf_airport.h.
Referenced by IsAvailable().
TimerGameCalendar::Year AirportSpec::min_year |
first year the airport is available
Definition at line 113 of file newgrf_airport.h.
Referenced by IsAvailable().
StringID AirportSpec::name |
name of this airport
Definition at line 115 of file newgrf_airport.h.
uint8_t AirportSpec::noise_level |
noise that this airport generates
Definition at line 111 of file newgrf_airport.h.
Referenced by GetAirportNoiseLevelForDistance().
SpriteID AirportSpec::preview_sprite |
preview sprite for this airport
Definition at line 117 of file newgrf_airport.h.
uint8_t AirportSpec::size_x |
size of airport in x direction
Definition at line 109 of file newgrf_airport.h.
Referenced by AirportGetNearestTown(), CmdBuildAirport(), Airport::GetRotatedTileFromOffset(), and IsWithinMapBounds().
uint8_t AirportSpec::size_y |
size of airport in y direction
Definition at line 110 of file newgrf_airport.h.
Referenced by AirportGetNearestTown(), CmdBuildAirport(), Airport::GetRotatedTileFromOffset(), and IsWithinMapBounds().
|
staticprivate |
Specs of the airports.
Airport specifications.
Definition at line 141 of file newgrf_airport.h.
Referenced by Get(), GetIndex(), GetWithoutOverride(), and ResetAirports().
TTDPAirportType AirportSpec::ttd_airport_type |
ttdpatch airport type (Small/Large/Helipad/Oilrig)
Definition at line 116 of file newgrf_airport.h.