|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
20 #include "table/strings.h"
42 return &AirportTileSpec::tiles[gfx];
67 void AirportTileOverrideManager::SetEntitySpec(
const AirportTileSpec *airpts)
72 GrfMsg(1,
"AirportTile.SetEntitySpec: Too many airport tiles allocated. Ignoring.");
76 AirportTileSpec::tiles[airpt_id] = *airpts;
85 overridden_airpts->
enabled =
false;
87 this->grfid_overrides[i] = 0;
129 if (!st->TileBelongsToAirport(tile)) {
139 return 0xFF << 8 | gfx;
159 return 0xFF << 8 | ats->
grf_prop.subst_id;
164 assert(this->
st !=
nullptr);
185 if (this->
st->TileBelongsToAirport(tile)) {
195 Debug(grf, 1,
"Unhandled airport tile variable 0x{:X}", variable);
216 CallbackID callback, uint32_t callback_param1, uint32_t callback_param2)
217 :
ResolverObject(ats->grf_prop.grffile, callback, callback_param1, callback_param2),
218 tiles_scope(*this, ats, tile, st),
219 airport_scope(*this, tile, st, st != nullptr ? st->airport.type : (byte)
AT_DUMMY, st != nullptr ? st->airport.layout : 0)
226 return GSF_AIRPORTTILES;
237 return object.ResolveCallback();
249 DrawWaterClassGround(ti);
261 bool draw_old_one =
true;
273 if (group ==
nullptr || group->type != SGT_TILELAYOUT) {
294 if (ats ==
nullptr)
return;
312 if (st->TileBelongsToAirport(tile)) AirportTileAnimationTrigger(st, tile, trigger, cargo_type);
static const uint INVALID_AIRPORTTILE
id for an invalid airport tile
PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
byte StationGfx
Copy from station_map.h.
static Titem * Get(size_t index)
Returns Titem with given index.
TileIndex tile
Tile for the callback, only valid for airporttile callbacks.
@ CBM_AIRT_ANIM_NEXT_FRAME
decides next animation frame
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
@ TO_BUILDINGS
company buildings - depots, stations, HQ, ...
Tile information, used while rendering the tile.
@ SPRITE_WIDTH
number of bits for the sprite number
uint16_t triggers
The triggers that trigger animation.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Tindex index
Index of this pool item.
uint8_t animation_special_flags
Extra flags to influence the animation.
AirportTileResolverObject(const AirportTileSpec *ats, TileIndex tile, Station *st, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Constructor of the resolver for airport tiles.
SpriteID sprite
The 'real' sprite.
struct Station * st
Station of the airport for which the callback is run, or nullptr for build gui.
Interface for SpriteGroup-s to access the gamestate.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
uint32_t GetTerrainType(TileIndex tile, TileContext context)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
CallbackID
List of implemented NewGRF callbacks.
Owner owner
The owner of this station.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Slope tileh
Slope of the tile.
uint16_t invalid_id
ID used to detected invalid entities.
static void ResetAirportTiles()
This function initializes the tile array of AirportTileSpec.
PalSpriteID ground
Palette and sprite for the ground.
Defines the data structure of each individual tile of an airport.
uint16_t override
id of the entity been replaced by
@ CBID_AIRPTILE_ANIM_NEXT_FRAME
Called to determine airport tile next animation frame.
byte GetStationTileRandomBits(Tile t)
Get the random bits of a station tile.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
Airport airport
Tile area the airport covers.
static uint32_t GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint32_t cur_grfid)
Make an analysis of a tile and check whether it belongs to the same airport, and/or the same grf file...
static const uint NUM_AIRPORTTILES
Total number of airport tiles.
static const AirportTileSpec * GetByTile(TileIndex tile)
Retrieve airport tile spec for the given airport tile.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
uint32_t GetRandomBits() const override
Get a few random bits.
bool IsTileOnWater(Tile t)
Tests if the tile was built on water.
uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8)
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
Ground palette sprite of a tile, together with its sprite layout.
static void ChangeAnimationFrame(CallbackID cb, const AirportTileSpec *spec, Station *obj, TileIndex tile, uint32_t random_bits, uint32_t trigger, int extra_data=0)
Check a callback to determine what the next animation step is and execute that step.
byte CargoID
Cargo slots to indicate a cargo type within a game.
virtual uint16_t AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id)
Reserves a place in the mapping array for an entity to be installed.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
uint16_t local_id
id defined by the grf file for this entity
bool ConvertBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
Converts a callback result into a boolean.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32_t stage, PaletteID default_palette)
Draw NewGRF industrytile or house sprite layout.
AirportTileScopeResolver tiles_scope
Scope resolver for the tiles.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
@ CBM_AIRT_DRAW_FOUNDATIONS
decides if default foundations need to be drawn
const struct SpriteGroup * spritegroup[Tcnt]
pointer to the different sprites of the entity
static const AirportTileSpec _origin_airporttile_specs[]
All default airport tiles.
uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override
Get a variable value.
@ CBID_AIRPTILE_ANIM_START_STOP
Called for periodically starting or stopping the animation.
@ CBID_AIRPTILE_DRAW_FOUNDATIONS
Called to determine the type (if any) of foundation to draw for an airport tile.
StationID GetStationIndex(Tile t)
Get StationID from a tile.
TileIndex tile
The base tile of the area.
StationGfx GetAirportGfx(Tile t)
Get the station graphics of this airport tile.
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
bool enabled
entity still available (by default true). newgrf can disable it, though
@ MP_STATION
A tile of a station.
void ResetOverride()
Resets the override, which is used while initializing game.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
static uint32_t GetNearbyAirportTileInformation(byte parameter, TileIndex tile, StationID index, bool grf_version8)
Based on newhouses/newindustries equivalent, but adapted for airports.
uint32_t GetRelativePosition(TileIndex tile, TileIndex ind_tile)
This is the position of the tile relative to the northernmost tile of the industry.
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
Do airporttile gfx ID translation for NewGRFs.
static void AnimateTile(const AirportTileSpec *spec, Station *obj, TileIndex tile, bool random_animation, int extra_data=0)
Animate a single tile.
uint16_t random_bits
Random bits assigned to this station.
Helper class for a unified approach to NewGRF animation.
virtual const SpriteGroup * Resolve([[maybe_unused]] ResolverObject &object) const
Base sprite group resolver.
#define lengthof(x)
Return the length of an fixed size array.
byte GetAnimationFrame(Tile t)
Get the current animation frame.
Helper class for animation control.
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axis axis)
Get the tile at the given offset.
static const uint NEW_AIRPORTTILE_OFFSET
offset of first newgrf airport tile
PaletteID pal
The palette (use PAL_NONE) if not needed)
TileIndex tile
Tile index.
uint16_t max_offset
what is the length of the original entity's array of specs
uint8_t callback_mask
Bitmask telling which grf callback is set.
Resolver for tiles of an airport.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
ResolverObject & ro
Surrounding resolver object.
AirpAnimationTrigger
Animation triggers for airport tiles.
const struct GRFFile * grffile
grf file that introduced this entity
@ CBID_AIRPTILE_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
static const AirportTileSpec * Get(StationGfx gfx)
Retrieve airport tile spec for the given airport tile.
GRFFileProps grf_prop
properties related the the grf file
const DrawTileSprites * ProcessRegisters(uint8_t *stage) const
Process registers and the construction stage into the sprite layout.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
bool IsAirport(Tile t)
Is this station tile an airport?
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite for the current tile.
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
AnimationInfo animation
Information about the animation.
AirportTileCallbackMask
Callback masks for airport tiles.
@ CBM_AIRT_ANIM_SPEED
decides animation speed
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.