22 #include "table/strings.h" 43 return &AirportTileSpec::tiles[gfx];
61 memset(&AirportTileSpec::tiles, 0,
sizeof(AirportTileSpec::tiles));
68 void AirportTileOverrideManager::SetEntitySpec(
const AirportTileSpec *airpts)
72 if (airpt_id == invalid_ID) {
73 grfmsg(1,
"AirportTile.SetEntitySpec: Too many airport tiles allocated. Ignoring.");
77 memcpy(&AirportTileSpec::tiles[airpt_id], airpts,
sizeof(*airpts));
80 for (
int i = 0; i < max_offset; i++) {
86 overridden_airpts->
enabled =
false;
87 entity_overrides[i] = invalid_ID;
88 grfid_overrides[i] = 0;
130 if (!st->TileBelongsToAirport(tile)) {
140 return 0xFF << 8 | gfx;
160 return 0xFF << 8 | ats->
grf_prop.subst_id;
165 assert(this->st != NULL);
188 if (this->st->TileBelongsToAirport(tile)) {
198 DEBUG(grf, 1,
"Unhandled airport tile variable 0x%X", variable);
219 CallbackID callback, uint32 callback_param1, uint32 callback_param2)
228 return object.ResolveCallback();
240 DrawWaterClassGround(ti);
252 bool draw_old_one =
true;
264 if (group == NULL || group->type != SGT_TILELAYOUT) {
285 if (ats == NULL)
return;
303 if (st->TileBelongsToAirport(tile)) AirportTileAnimationTrigger(st, tile, trigger, cargo_type);
Definition of stuff that is very close to a company, like the company struct itself.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
Tile information, used while rendering the tile.
company buildings - depots, stations, HQ, ...
uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
This is the position of the tile relative to the northernmost tile of the industry.
uint16 triggers
The triggers that trigger animation.
Called to determine airport tile next animation frame.
static Titem * Get(size_t index)
Returns Titem with given index.
static const AirportTileSpec * GetByTile(TileIndex tile)
Retrieve airport tile spec for the given airport tile.
static byte GetAnimationFrame(TileIndex t)
Get the current animation frame.
Functions related to debugging.
static void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32 stage, PaletteID default_palette)
Draw NewGRF industrytile or house sprite layout.
Interface for SpriteGroup-s to access the gamestate.
uint32 GetTerrainType(TileIndex tile, TileContext context)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
Slope tileh
Slope of the tile.
static const uint INVALID_AIRPORTTILE
id for an invalid airport tile
static StationGfx GetAirportGfx(TileIndex t)
Get the station graphics of this airport tile.
static void ChangeAnimationFrame(CallbackID cb, const AirportTileSpec *spec, Station *obj, TileIndex tile, uint32 random_bits, uint32 trigger, int extra_data=0)
Check a callback to determine what the next animation step is and execute that step.
static void AnimateTile(const AirportTileSpec *spec, Station *obj, TileIndex tile, bool random_animation, int extra_data=0)
Animate a single tile.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
AirportTileResolverObject(const AirportTileSpec *ats, TileIndex tile, Station *st, CallbackID callback=CBID_NO_CALLBACK, uint32 callback_param1=0, uint32 callback_param2=0)
Constructor of the resolver for airport tiles.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold...
virtual const SpriteGroup * Resolve(ResolverObject &object) const
Base sprite group resolver.
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axis axis)
Get the tile at the given offset.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a give tiletype.
const DrawTileSprites * ProcessRegisters(uint8 *stage) const
Process registers and the construction stage into the sprite layout.
TileIndex tile
Tile index.
decides if default foundations need to be drawn
The tile is leveled up to a flat slope.
static uint32 GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint32 cur_grfid)
Make an analysis of a tile and check whether it belongs to the same airport, and/or the same grf file...
Ground palette sprite of a tile, together with its sprite layout.
Resolver for tiles of an airport.
decides next animation frame
bool ConvertBooleanCallback(const GRFFile *grffile, uint16 cbid, uint16 cb_res)
Converts a callback result into a boolean.
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
Definition of base types and functions in a cross-platform compatible way.
static void ResetAirportTiles()
This function initializes the tile array of AirportTileSpec.
Function implementations related to NewGRF animation.
bool enabled
entity still available (by default true). newgrf can disable it, though
A number of safeguards to prevent using unsafe methods.
static PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
static const uint NUM_AIRPORTTILES
Total number of airport tiles.
static bool IsAirport(TileIndex t)
Is this station tile an airport?
uint8 animation_special_flags
Extra flags to influence the animation.
static const AirportTileSpec * Get(StationGfx gfx)
Retrieve airport tile spec for the given airport tile.
AirportTileCallbackMask
Callback masks for airport tiles.
#define lengthof(x)
Return the length of an fixed size array.
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
number of bits for the sprite number
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
const struct SpriteGroup * spritegroup[Tcnt]
pointer to the different sprites of the entity
Helper class for animation control.
NewGRF handling of airport tiles.
uint32 GetVariable(byte variable, uint32 parameter, bool *available) const
Get a variable value.
uint32 GetRandomBits() const
Get a few random bits.
#define DEBUG(name, level,...)
Output a line of debugging information.
uint16 override
id of the entity been replaced by
TileIndex tile
The base tile of the area.
OwnerByte owner
The owner of this station.
byte StationGfx
Copy from station_map.h.
Called to determine the type (if any) of foundation to draw for an airport tile.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
PalSpriteID ground
Palette and sprite for the ground.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
uint32 GetNearbyTileInformation(TileIndex tile, bool grf_version8)
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
uint32 TileIndex
The index/ID of a Tile.
Helper class for a unified approach to NewGRF animation.
AnimationInfo animation
Information about the animation.
void CDECL grfmsg(int severity, const char *str,...)
DEBUG() function dedicated to newGRF debugging messages Function is essentially the same as DEBUG(grf...
CallbackID callback
Callback being resolved.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
static const AirportTileSpec _origin_airporttile_specs[]
All default airport tiles.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
Called to indicate how long the current animation frame should last.
Functions related to OTTD's landscape.
Defines the data structure of each individual tile of 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.
uint8 callback_mask
Bitmask telling which grf callback is set.
uint16 local_id
id defined by the grf file for this entity
Airport airport
Tile area the airport covers.
void ResetOverride()
Resets the override, which is used while initializing game.
const struct GRFFile * grffile
grf file that introduced this entity
CallbackID
List of implemented NewGRF callbacks.
Called for periodically starting or stopping the animation.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Functions related to NewGRF provided sounds.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
static const uint NEW_AIRPORTTILE_OFFSET
offset of first newgrf airport tile
byte CargoID
Cargo slots to indicate a cargo type within a game.
Functions related to water (management)
static bool IsTileOnWater(TileIndex t)
Tests if the tile was built on water.
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
Do airporttile gfx ID translation for NewGRFs.
SpriteID sprite
The 'real' sprite.
Base classes/functions for stations.
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
GRFFileProps grf_prop
properties related the the grf file
static byte GetStationTileRandomBits(TileIndex t)
Get the random bits of a station tile.
Tables with airporttile defaults.
static uint32 GetNearbyAirportTileInformation(byte parameter, TileIndex tile, StationID index, bool grf_version8)
Based on newhouses/newindustries equivalent, but adapted for airports.
AirpAnimationTrigger
Animation triggers for airport tiles.
PaletteID pal
The palette (use PAL_NONE) if not needed)