OpenTTD Source 20250509-master-gb1cdf5024f
newgrf_airporttiles.cpp File Reference

NewGRF handling of airport tiles. More...

#include "stdafx.h"
#include "debug.h"
#include "newgrf_airporttiles.h"
#include "newgrf_badge.h"
#include "newgrf_spritegroup.h"
#include "newgrf_sound.h"
#include "station_base.h"
#include "water.h"
#include "landscape.h"
#include "company_base.h"
#include "town.h"
#include "newgrf_animation_base.h"
#include "table/strings.h"
#include "table/airporttiles.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  AirportTileAnimationBase
 Helper class for animation control. More...
 

Functions

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 uint32_t GetNearbyAirportTileInformation (uint8_t parameter, TileIndex tile, StationID index, bool grf_version8)
 Based on newhouses/newindustries equivalent, but adapted for airports.
 
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 uint16_t GetAirportTileCallback (CallbackID callback, uint32_t param1, uint32_t param2, const AirportTileSpec *ats, Station *st, TileIndex tile, std::span< int32_t > regs100={})
 
static void AirportDrawTileLayout (const TileInfo *ti, const DrawTileSpriteSpan &dts, Colours colour)
 
bool DrawNewAirportTile (TileInfo *ti, Station *st, const AirportTileSpec *airts)
 
static uint16_t GetSimpleAirportTileCallback (CallbackID callback, uint32_t param1, uint32_t param2, const AirportTileSpec *ats, Station *st, TileIndex tile, int)
 
void AnimateAirportTile (TileIndex tile)
 
static bool DoTriggerAirportTileAnimation (Station *st, TileIndex tile, AirportAnimationTrigger trigger, uint32_t random, uint32_t var18_extra=0)
 
bool TriggerAirportTileAnimation (Station *st, TileIndex tile, AirportAnimationTrigger trigger)
 
bool TriggerAirportAnimation (Station *st, AirportAnimationTrigger trigger, CargoType cargo_type)
 

Variables

AirportTileOverrideManager _airporttile_mngr (NEW_AIRPORTTILE_OFFSET, NUM_AIRPORTTILES, INVALID_AIRPORTTILE)
 

Detailed Description

NewGRF handling of airport tiles.

Definition in file newgrf_airporttiles.cpp.

Function Documentation

◆ AirportDrawTileLayout()

static void AirportDrawTileLayout ( const TileInfo ti,
const DrawTileSpriteSpan dts,
Colours  colour 
)
static

Definition at line 244 of file newgrf_airporttiles.cpp.

◆ AnimateAirportTile()

void AnimateAirportTile ( TileIndex  tile)

Definition at line 300 of file newgrf_airporttiles.cpp.

◆ DoTriggerAirportTileAnimation()

static bool DoTriggerAirportTileAnimation ( Station st,
TileIndex  tile,
AirportAnimationTrigger  trigger,
uint32_t  random,
uint32_t  var18_extra = 0 
)
static

Definition at line 308 of file newgrf_airporttiles.cpp.

◆ DrawNewAirportTile()

bool DrawNewAirportTile ( TileInfo ti,
Station st,
const AirportTileSpec airts 
)

Definition at line 260 of file newgrf_airporttiles.cpp.

◆ GetAirportTileCallback()

static uint16_t GetAirportTileCallback ( CallbackID  callback,
uint32_t  param1,
uint32_t  param2,
const AirportTileSpec ats,
Station st,
TileIndex  tile,
std::span< int32_t >  regs100 = {} 
)
static

Definition at line 238 of file newgrf_airporttiles.cpp.

◆ GetAirportTileIDAtOffset()

static uint32_t GetAirportTileIDAtOffset ( TileIndex  tile,
const Station st,
uint32_t  cur_grfid 
)
static

Make an analysis of a tile and check whether it belongs to the same airport, and/or the same grf file.

Parameters
tileTileIndex of the tile to query
stStation to which to compare the tile to
cur_grfidGRFID of the current callback
Returns
value encoded as per NFO specs

Definition at line 129 of file newgrf_airporttiles.cpp.

References AirportTileSpec::Get(), GetAirportGfx(), AirportTileSpec::grf_prop, GRFFilePropsBase::grfid, StandardGRFFileProps::HasSpriteGroups(), INVALID_AIRPORTTILE, GRFFilePropsBase::local_id, NEW_AIRPORTTILE_OFFSET, and SubstituteGRFFileProps::override_id.

Referenced by AirportTileScopeResolver::GetVariable().

◆ GetNearbyAirportTileInformation()

static uint32_t GetNearbyAirportTileInformation ( uint8_t  parameter,
TileIndex  tile,
StationID  index,
bool  grf_version8 
)
static

Based on newhouses/newindustries equivalent, but adapted for airports.

Parameters
parameterfrom callback. It's in fact a pair of coordinates
tileTileIndex from which the callback was initiated
indexof the industry been queried for
grf_version8True, if we are dealing with a new NewGRF which uses GRF version >= 8.
Returns
a construction of bits obeying the newgrf format

Definition at line 112 of file newgrf_airporttiles.cpp.

References GetNearbyTile(), GetNearbyTileInformation(), GetStationIndex(), IsAirport(), IsTileType(), and MP_STATION.

Referenced by AirportTileScopeResolver::GetVariable().

◆ GetRelativePosition()

uint32_t GetRelativePosition ( TileIndex  tile,
TileIndex  ind_tile 
)
extern

This is the position of the tile relative to the northernmost tile of the industry.

Format: 00yxYYXX Variable Content x the x offset from the northernmost tile XX same, but stored in a byte instead of a nibble y the y offset from the northernmost tile YY same, but stored in a byte instead of a nibble

Parameters
tileTileIndex of the tile to evaluate
ind_tilenorthernmost tile of the industry

Definition at line 54 of file newgrf_industrytiles.cpp.

References TileX(), and TileY().

Referenced by AirportTileScopeResolver::GetVariable(), and IndustryTileScopeResolver::GetVariable().

◆ GetSimpleAirportTileCallback()

static uint16_t GetSimpleAirportTileCallback ( CallbackID  callback,
uint32_t  param1,
uint32_t  param2,
const AirportTileSpec ats,
Station st,
TileIndex  tile,
int   
)
static

Definition at line 286 of file newgrf_airporttiles.cpp.

◆ GetTranslatedAirportTileID()

StationGfx GetTranslatedAirportTileID ( StationGfx  gfx)

Do airporttile gfx ID translation for NewGRFs.

Parameters
gfxthe type to get the override for.
Returns
the gfx to actually work with.

Definition at line 98 of file newgrf_airporttiles.cpp.

References AirportTileSpec::Get(), AirportTileSpec::grf_prop, INVALID_AIRPORTTILE, and SubstituteGRFFileProps::override_id.

Referenced by CmdBuildAirport(), and GetAirportGfx().

◆ TriggerAirportAnimation()

bool TriggerAirportAnimation ( Station st,
AirportAnimationTrigger  trigger,
CargoType  cargo_type 
)

Definition at line 322 of file newgrf_airporttiles.cpp.

◆ TriggerAirportTileAnimation()

bool TriggerAirportTileAnimation ( Station st,
TileIndex  tile,
AirportAnimationTrigger  trigger 
)

Definition at line 317 of file newgrf_airporttiles.cpp.