OpenTTD Source 20261112-master-gbcbec5e63f
newgrf_airport.h File Reference

NewGRF handling of airports. More...

#include "airport.h"
#include "timer/timer_game_calendar.h"
#include "newgrf_badge_type.h"
#include "newgrf_class.h"
#include "newgrf_commons.h"
#include "newgrf_spritegroup.h"
#include "newgrf_town.h"

Go to the source code of this file.

Data Structures

struct  AirportTileTable
 Tile-offset / AirportTileID pair. More...
struct  HangarTileTable
 A list of all hangar tiles in an airport. More...
struct  AirportTileLayout
struct  AirportSpec
 Defines the data structure for an airport. More...
struct  AirportScopeResolver
 Resolver for the airport scope. More...
struct  AirportResolverObject
 Resolver object for airports. More...

Typedefs

using AirportGfx = uint16_t
 Airport graphics tile.
using AirportClassID = PoolID<uint8_t, struct AirportClassIDTag, 16, UINT8_MAX>
 Class IDs for airports.
using AirportClass = NewGRFClass<AirportSpec, AirportClassID>
 Information related to airport classes.

Enumerations

enum  TTDPAirportType : uint8_t { ATP_TTDP_SMALL , ATP_TTDP_LARGE , ATP_TTDP_HELIPORT , ATP_TTDP_OILRIG }
 TTDP airport types. More...

Functions

void BindAirportSpecs ()
 Tie all airportspecs to their class.
StringID GetAirportTextCallback (const AirportSpec *as, uint8_t layout, uint16_t callback)
 Get a custom text for the airport.

Variables

static constexpr AirportGfx AIRPORTGFX_CLEARTILE_SPECIALCHECK = UINT16_MAX
 Sentinel marker in airport layout to perform a clear tile check.
static constexpr AirportClassID APC_SMALL {0}
 id for small airports class.
static constexpr AirportClassID APC_LARGE {1}
 id for large airports class.
static constexpr AirportClassID APC_HUB {2}
 id for hub airports class.
static constexpr AirportClassID APC_HELIPORT {3}
 id for heliports.

Detailed Description

NewGRF handling of airports.

Definition in file newgrf_airport.h.

Typedef Documentation

◆ AirportClass

Information related to airport classes.

Definition at line 110 of file newgrf_airport.h.

◆ AirportClassID

using AirportClassID = PoolID<uint8_t, struct AirportClassIDTag, 16, UINT8_MAX>

Class IDs for airports.

Definition at line 34 of file newgrf_airport.h.

◆ AirportGfx

using AirportGfx = uint16_t

Airport graphics tile.

Definition at line 22 of file newgrf_airport.h.

Enumeration Type Documentation

◆ TTDPAirportType

enum TTDPAirportType : uint8_t

TTDP airport types.

Used to map our types to TTDPatch's

Enumerator
ATP_TTDP_SMALL 

Same as AT_SMALL.

ATP_TTDP_LARGE 

Same as AT_LARGE.

ATP_TTDP_HELIPORT 

Same as AT_HELIPORT.

ATP_TTDP_OILRIG 

Same as AT_OILRIG.

Definition at line 42 of file newgrf_airport.h.

Function Documentation

◆ BindAirportSpecs()

void BindAirportSpecs ( )

Tie all airportspecs to their class.

Definition at line 131 of file newgrf_airport.cpp.

References NewGRFClass< AirportSpec, AirportClassID >::Assign(), AirportSpec::enabled, AirportSpec::GetWithoutOverride(), and NUM_AIRPORTS.

Referenced by AfterLoadGRFs().

◆ GetAirportTextCallback()

StringID GetAirportTextCallback ( const AirportSpec * as,
uint8_t layout,
uint16_t callback )

Get a custom text for the airport.

Parameters
asThe airport type's specification.
layoutThe layout index.
callbackThe callback to call.
Returns
The custom text.

Definition at line 283 of file newgrf_airport.cpp.

References CALLBACK_FAILED, ErrorUnknownCallbackResult(), GetGRFStringID(), AirportSpec::grf_prop, GRFFilePropsBase::grfid, GRFSTR_MISC_GRF_TEXT, and INVALID_TILE.

Referenced by BuildAirportWindow::DrawWidget(), BuildAirportWindow::GetWidgetString(), and BuildAirportWindow::UpdateWidgetSize().

Variable Documentation

◆ AIRPORTGFX_CLEARTILE_SPECIALCHECK

AirportGfx AIRPORTGFX_CLEARTILE_SPECIALCHECK = UINT16_MAX
staticconstexpr

Sentinel marker in airport layout to perform a clear tile check.

Definition at line 25 of file newgrf_airport.h.

Referenced by AirportChangeInfo(), CheckFlatLandAirport(), and AirportTileTableIterator::operator++().

◆ APC_HELIPORT

AirportClassID APC_HELIPORT {3}
staticconstexpr

id for heliports.

Definition at line 39 of file newgrf_airport.h.

◆ APC_HUB

AirportClassID APC_HUB {2}
staticconstexpr

id for hub airports class.

Definition at line 38 of file newgrf_airport.h.

◆ APC_LARGE

AirportClassID APC_LARGE {1}
staticconstexpr

id for large airports class.

Definition at line 37 of file newgrf_airport.h.

◆ APC_SMALL

AirportClassID APC_SMALL {0}
staticconstexpr

id for small airports class.

Definition at line 36 of file newgrf_airport.h.