10#ifndef NEWGRF_AIRPORT_H
11#define NEWGRF_AIRPORT_H
49 if (this->att->
ti.
x == -0x80) {
60 return this->att->
gfx;
63 std::unique_ptr<TileIterator>
Clone()
const override
65 return std::make_unique<AirportTileTableIterator>(*
this);
98 std::vector<AirportTileTable>
tiles;
134 assert(
this >= std::begin(
specs) &&
this < std::end(
specs));
135 return static_cast<uint8_t
>(std::distance(std::cbegin(
specs),
this));
170 uint32_t
GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter,
bool &available)
const override;
171 void StorePSA(uint pos, int32_t value)
override;
192 if (tsr !=
nullptr)
return tsr;
Various declarations for airports.
@ NUM_AIRPORTS
Maximal number of airports in total.
Iterator to iterate over all tiles belonging to an airport spec.
const AirportTileTable * att
The offsets.
TileIndex base_tile
The tile we base the offsets off.
AirportTileTableIterator(const AirportTileTable *att, TileIndex base_tile)
Construct the iterator.
StationGfx GetStationGfx() const
Get the StationGfx for the current tile.
TileIterator & operator++() override
Move ourselves to the next tile in the rectangle on the map.
std::unique_ptr< TileIterator > Clone() const override
Allocate a new iterator that is a copy of this one.
Struct containing information relating to NewGRF classes for stations and airports.
Base class for tile iterators.
TileIndex tile
The current tile we are at.
Direction
Defines the 8 directions on the map.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
Return the offset between two tiles from a TileIndexDiffC struct.
void BindAirportSpecs()
Tie all airportspecs to their class.
AirportClassID
List of default airport classes.
@ APC_MAX
maximum number of airport classes
@ APC_HELIPORT
id for heliports
@ APC_SMALL
id for small airports class
@ APC_BEGIN
Lowest valid airport class id.
@ APC_LARGE
id for large airports class
@ APC_HUB
id for hub airports class
TTDPAirportType
Allow incrementing of AirportClassID variables.
@ ATP_TTDP_HELIPORT
Same as AT_HELIPORT.
@ ATP_TTDP_OILRIG
Same as AT_OILRIG.
@ ATP_TTDP_SMALL
Same as AT_SMALL.
@ ATP_TTDP_LARGE
Same as AT_LARGE.
uint8_t StationGfx
Copy from station_map.h.
StringID GetAirportTextCallback(const AirportSpec *as, uint8_t layout, uint16_t callback)
Get a custom text for the airport.
CallbackID
List of implemented NewGRF callbacks.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
Header file for classes to be used by e.g.
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities.
@ VSG_SCOPE_SELF
Resolved object itself.
@ VSG_SCOPE_PARENT
Related object of the resolved one.
Functions to handle the town part of NewGRF towns.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Finite sTate mAchine (FTA) of an airport.
Resolver object for airports.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
TownScopeResolver * GetTown()
Get the town scope associated with a station, if it exists.
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0) override
Get a resolver for the scope.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
std::optional< TownScopeResolver > town_scope
The town scope resolver (created on the first call).
Resolver for the airport scope.
uint32_t GetRandomBits() const override
Get a few random bits.
const AirportSpec * spec
AirportSpec for which the callback is run.
uint8_t layout
Layout of the airport to build.
void StorePSA(uint pos, int32_t value) override
Store a value into the object's persistent storage.
TileIndex tile
Tile for the callback, only valid for airporttile callbacks.
uint32_t GetVariable(uint8_t variable, uint32_t parameter, bool &available) const override
Get a variable value.
struct Station * st
Station of the airport for which the callback is run, or nullptr for build gui.
AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, const AirportSpec *spec, uint8_t layout)
Constructor of the scope resolver for an airport.
Defines the data structure for an airport.
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
TimerGameCalendar::Year min_year
first year the airport is available
static void ResetAirports()
This function initializes the airportspec array.
std::vector< AirportTileLayout > layouts
List of layouts composing the airport.
static AirportSpec specs[NUM_AIRPORTS]
Specs of the airports.
struct GRFFileProps grf_prop
Properties related to the grf file.
uint8_t catchment
catchment area of this airport
static const AirportSpec dummy
The dummy airport.
uint16_t maintenance_cost
maintenance cost multiplier
bool IsWithinMapBounds(uint8_t table, TileIndex index) const
Check if the airport would be within the map bounds at the given tile.
static AirportSpec * GetWithoutOverride(uint8_t type)
Retrieve airport spec for the given airport.
const struct AirportFTAClass * fsm
the finite statemachine for the default airports
TimerGameCalendar::Year max_year
last year the airport is available
bool enabled
Entity still available (by default true). Newgrf can disable it, though.
uint8_t size_y
size of airport in y direction
uint8_t size_x
size of airport in x direction
static const AirportSpec * Get(uint8_t type)
Retrieve airport spec for the given airport.
std::span< const HangarTileTable > depots
Position of the depots on the airports.
uint8_t GetIndex() const
Get the index of this spec.
bool IsAvailable() const
Check whether this airport is available to build.
uint8_t noise_level
noise that this airport generates
std::vector< AirportTileTable > tiles
List of all tiles in this layout.
Direction rotation
The rotation of this layout.
Tile-offset / AirportTileID pair.
StationGfx gfx
AirportTile to use for this tile.
TileIndexDiffC ti
Tile offset from the top-most airport tile.
Data related to the handling of grf files.
A list of all hangar tiles in an airport.
Direction dir
Direction of the exit.
TileIndexDiffC ti
Tile offset from the top-most airport tile.
uint8_t hangar_num
The hangar to which this tile belongs.
uint16_t index
Index within class of this spec, invalid until inserted into class.
Interface for SpriteGroup-s to access the gamestate.
uint32_t callback_param2
Second parameter (var 18) of the callback.
CallbackID callback
Callback being resolved.
uint32_t callback_param1
First parameter (var 10) of the callback.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0)
Get a resolver for the scope.
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
ResolverObject & ro
Surrounding resolver object.
A pair-construct of a TileIndexDiff.
int16_t x
The x value of the coordinate.
Scope resolver for a town.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Type for storing the 'area' of something uses on the map.
Definition of the game-calendar-timer.