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