OpenTTD Source: src/newgrf_airporttiles.cpp Source File

OpenTTD Source 14.0-RC3

newgrf_airporttiles.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #include "stdafx.h"
11 #include "debug.h"
12 #include "newgrf_airporttiles.h"
13 #include "newgrf_spritegroup.h"
14 #include "newgrf_sound.h"
15 #include "station_base.h"
16 #include "water.h"
17 #include "landscape.h"
18 #include "company_base.h"
19 #include "town.h"
20 #include "table/strings.h"
21 #include "table/airporttiles.h"
22 #include "newgrf_animation_base.h"
23
24 #include "safeguards.h"
25
26 extern uint32_t GetRelativePosition(TileIndex tile, TileIndex ind_tile);
27
28 AirportTileSpec AirportTileSpec::tiles[NUM_AIRPORTTILES];
29
30 AirportTileOverrideManager _airporttile_mngr(NEW_AIRPORTTILE_OFFSET, NUM_AIRPORTTILES, INVALID_AIRPORTTILE);
31
37 /* static */ const AirportTileSpec *AirportTileSpec::Get(StationGfx gfx)
38 {
39 /* should be assert(gfx < lengthof(tiles)), but that gives compiler warnings
40 * since it's always true if the following holds: */
41 static_assert(MAX_UVALUE(StationGfx) + 1 == lengthof(tiles));
42 return &AirportTileSpec::tiles[gfx];
43 }
44
50 /* static */ const AirportTileSpec *AirportTileSpec::GetByTile(TileIndex tile)
51 {
52 return AirportTileSpec::Get(GetAirportGfx(tile));
53 }
54
58 void AirportTileSpec::ResetAirportTiles()
59 {
60 auto insert = std::copy(std::begin(_origin_airporttile_specs), std::end(_origin_airporttile_specs), std::begin(AirportTileSpec::tiles));
61 std::fill(insert, std::end(AirportTileSpec::tiles), AirportTileSpec{});
62
63 /* Reset any overrides that have been set. */
64 _airporttile_mngr.ResetOverride();
65 }
66
67 void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts)
68 {
69 StationGfx airpt_id = this->AddEntityID(airpts->grf_prop.local_id, airpts->grf_prop.grffile->grfid, airpts->grf_prop.subst_id);
70
71 if (airpt_id == this->invalid_id) {
72 GrfMsg(1, "AirportTile.SetEntitySpec: Too many airport tiles allocated. Ignoring.");
73 return;
74 }
75
76 AirportTileSpec::tiles[airpt_id] = *airpts;
77
78 /* Now add the overrides. */
79 for (int i = 0; i < this->max_offset; i++) {
80 AirportTileSpec *overridden_airpts = &AirportTileSpec::tiles[i];
81
82 if (this->entity_overrides[i] != airpts->grf_prop.local_id || this->grfid_overrides[i] != airpts->grf_prop.grffile->grfid) continue;
83
84 overridden_airpts->grf_prop.override = airpt_id;
85 overridden_airpts->enabled = false;
86 this->entity_overrides[i] = this->invalid_id;
87 this->grfid_overrides[i] = 0;
88 }
89 }
90
96 StationGfx GetTranslatedAirportTileID(StationGfx gfx)
97 {
98 const AirportTileSpec *it = AirportTileSpec::Get(gfx);
99 return it->grf_prop.override == INVALID_AIRPORTTILE ? gfx : it->grf_prop.override;
100 }
101
110 static uint32_t GetNearbyAirportTileInformation(byte parameter, TileIndex tile, StationID index, bool grf_version8)
111 {
112 if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required
113 bool is_same_airport = (IsTileType(tile, MP_STATION) && IsAirport(tile) && GetStationIndex(tile) == index);
114
115 return GetNearbyTileInformation(tile, grf_version8) | (is_same_airport ? 1 : 0) << 8;
116 }
117
118
127 static uint32_t GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint32_t cur_grfid)
128 {
129 if (!st->TileBelongsToAirport(tile)) {
130 return 0xFFFF;
131 }
132
133 StationGfx gfx = GetAirportGfx(tile);
134 const AirportTileSpec *ats = AirportTileSpec::Get(gfx);
135
136 if (gfx < NEW_AIRPORTTILE_OFFSET) { // Does it belongs to an old type?
137 /* It is an old tile. We have to see if it's been overridden */
138 if (ats->grf_prop.override == INVALID_AIRPORTTILE) { // has it been overridden?
139 return 0xFF << 8 | gfx; // no. Tag FF + the gfx id of that tile
140 }
141 /* Overridden */
142 const AirportTileSpec *tile_ovr = AirportTileSpec::Get(ats->grf_prop.override);
143
144 if (tile_ovr->grf_prop.grffile->grfid == cur_grfid) {
145 return tile_ovr->grf_prop.local_id; // same grf file
146 } else {
147 return 0xFFFE; // not the same grf file
148 }
149 }
150 /* Not an 'old type' tile */
151 if (ats->grf_prop.spritegroup[0] != nullptr) { // tile has a spritegroup ?
152 if (ats->grf_prop.grffile->grfid == cur_grfid) { // same airport, same grf ?
153 return ats->grf_prop.local_id;
154 } else {
155 return 0xFFFE; // Defined in another grf file
156 }
157 }
158 /* The tile has no spritegroup */
159 return 0xFF << 8 | ats->grf_prop.subst_id; // so just give it the substitute
160 }
161
162 /* virtual */ uint32_t AirportTileScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const
163 {
164 assert(this->st != nullptr);
165
166 switch (variable) {
167 /* Terrain type */
168 case 0x41: return GetTerrainType(this->tile);
169
170 /* Current town zone of the tile in the nearest town */
171 case 0x42: return GetTownRadiusGroup(ClosestTownFromTile(this->tile, UINT_MAX), this->tile);
172
173 /* Position relative to most northern airport tile. */
174 case 0x43: return GetRelativePosition(this->tile, this->st->airport.tile);
175
176 /* Animation frame of tile */
177 case 0x44: return GetAnimationFrame(this->tile);
178
179 /* Land info of nearby tiles */
180 case 0x60: return GetNearbyAirportTileInformation(parameter, this->tile, this->st->index, this->ro.grffile->grf_version >= 8);
181
182 /* Animation stage of nearby tiles */
183 case 0x61: {
184 TileIndex tile = GetNearbyTile(parameter, this->tile);
185 if (this->st->TileBelongsToAirport(tile)) {
186 return GetAnimationFrame(tile);
187 }
188 return UINT_MAX;
189 }
190
191 /* Get airport tile ID at offset */
192 case 0x62: return GetAirportTileIDAtOffset(GetNearbyTile(parameter, this->tile), this->st, this->ro.grffile->grfid);
193 }
194
195 Debug(grf, 1, "Unhandled airport tile variable 0x{:X}", variable);
196
197 *available = false;
198 return UINT_MAX;
199 }
200
201 /* virtual */ uint32_t AirportTileScopeResolver::GetRandomBits() const
202 {
203 return (this->st == nullptr ? 0 : this->st->random_bits) | (this->tile == INVALID_TILE ? 0 : GetStationTileRandomBits(this->tile) << 16);
204 }
205
215 AirportTileResolverObject::AirportTileResolverObject(const AirportTileSpec *ats, TileIndex tile, Station *st,
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)
220 {
221 this->root_spritegroup = ats->grf_prop.spritegroup[0];
222 }
223
224 GrfSpecFeature AirportTileResolverObject::GetFeature() const
225 {
226 return GSF_AIRPORTTILES;
227 }
228
229 uint32_t AirportTileResolverObject::GetDebugID() const
230 {
231 return this->tiles_scope.ats->grf_prop.local_id;
232 }
233
234 uint16_t GetAirportTileCallback(CallbackID callback, uint32_t param1, uint32_t param2, const AirportTileSpec *ats, Station *st, TileIndex tile, [[maybe_unused]] int extra_data = 0)
235 {
236 AirportTileResolverObject object(ats, tile, st, callback, param1, param2);
237 return object.ResolveCallback();
238 }
239
240 static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour)
241 {
242 const DrawTileSprites *dts = group->ProcessRegisters(nullptr);
243
244 SpriteID image = dts->ground.sprite;
245 SpriteID pal = dts->ground.pal;
246
247 if (GB(image, 0, SPRITE_WIDTH) != 0) {
248 if (image == SPR_FLAT_WATER_TILE && IsTileOnWater(ti->tile)) {
249 DrawWaterClassGround(ti);
250 } else {
251 DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, GENERAL_SPRITE_COLOUR(colour)));
252 }
253 }
254
255 DrawNewGRFTileSeq(ti, dts, TO_BUILDINGS, 0, GENERAL_SPRITE_COLOUR(colour));
256 }
257
258 bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts)
259 {
260 if (ti->tileh != SLOPE_FLAT) {
261 bool draw_old_one = true;
262 if (HasBit(airts->callback_mask, CBM_AIRT_DRAW_FOUNDATIONS)) {
263 /* Called to determine the type (if any) of foundation to draw */
264 uint32_t callback_res = GetAirportTileCallback(CBID_AIRPTILE_DRAW_FOUNDATIONS, 0, 0, airts, st, ti->tile);
265 if (callback_res != CALLBACK_FAILED) draw_old_one = ConvertBooleanCallback(airts->grf_prop.grffile, CBID_AIRPTILE_DRAW_FOUNDATIONS, callback_res);
266 }
267
268 if (draw_old_one) DrawFoundation(ti, FOUNDATION_LEVELED);
269 }
270
271 AirportTileResolverObject object(airts, ti->tile, st);
272 const SpriteGroup *group = object.Resolve();
273 if (group == nullptr || group->type != SGT_TILELAYOUT) {
274 return false;
275 }
276
277 const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
278 AirportDrawTileLayout(ti, tlgroup, Company::Get(st->owner)->colour);
279 return true;
280 }
281
283 struct AirportTileAnimationBase : public AnimationBase<AirportTileAnimationBase, AirportTileSpec, Station, int, GetAirportTileCallback, TileAnimationFrameAnimationHelper<Station> > {
284 static const CallbackID cb_animation_speed = CBID_AIRPTILE_ANIMATION_SPEED;
285 static const CallbackID cb_animation_next_frame = CBID_AIRPTILE_ANIM_NEXT_FRAME;
286
287 static const AirportTileCallbackMask cbm_animation_speed = CBM_AIRT_ANIM_SPEED;
288 static const AirportTileCallbackMask cbm_animation_next_frame = CBM_AIRT_ANIM_NEXT_FRAME;
289 };
290
291 void AnimateAirportTile(TileIndex tile)
292 {
293 const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
294 if (ats == nullptr) return;
295
296 AirportTileAnimationBase::AnimateTile(ats, Station::GetByTile(tile), tile, HasBit(ats->animation_special_flags, 0));
297 }
298
299 void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type)
300 {
301 const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
302 if (!HasBit(ats->animation.triggers, trigger)) return;
303
304 AirportTileAnimationBase::ChangeAnimationFrame(CBID_AIRPTILE_ANIM_START_STOP, ats, st, tile, Random(), (uint8_t)trigger | (cargo_type << 8));
305 }
306
307 void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type)
308 {
309 if (st->airport.tile == INVALID_TILE) return;
310
311 for (TileIndex tile : st->airport) {
312 if (st->TileBelongsToAirport(tile)) AirportTileAnimationTrigger(st, tile, trigger, cargo_type);
313 }
314 }
315
INVALID_AIRPORTTILE
static const uint INVALID_AIRPORTTILE
id for an invalid airport tile
Definition: airport.h:25
GroundSpritePaletteTransform
PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
Definition: sprite.h:168
StationGfx
byte StationGfx
Copy from station_map.h.
Definition: newgrf_airport.h:22
Pool::PoolItem<&_company_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:339
AirportTileScopeResolver::tile
TileIndex tile
Tile for the callback, only valid for airporttile callbacks.
Definition: newgrf_airporttiles.h:24
CBM_AIRT_ANIM_NEXT_FRAME
@ CBM_AIRT_ANIM_NEXT_FRAME
decides next animation frame
Definition: newgrf_callbacks.h:410
water.h
ClosestTownFromTile
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
Definition: town_cmd.cpp:3744
TO_BUILDINGS
@ TO_BUILDINGS
company buildings - depots, stations, HQ, ...
Definition: transparency.h:27
TileInfo
Tile information, used while rendering the tile.
Definition: tile_cmd.h:43
SPRITE_WIDTH
@ SPRITE_WIDTH
number of bits for the sprite number
Definition: sprites.h:1527
company_base.h
Station
Station data structure.
Definition: station_base.h:442
AnimationInfo::triggers
uint16_t triggers
The triggers that trigger animation.
Definition: newgrf_animation_type.h:22
GB
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.
Definition: bitmath_func.hpp:32
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition: pool_type.hpp:238
AirportTileSpec::animation_special_flags
uint8_t animation_special_flags
Extra flags to influence the animation.
Definition: newgrf_airporttiles.h:72
AirportTileResolverObject::AirportTileResolverObject
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.
Definition: newgrf_airporttiles.cpp:215
PalSpriteID::sprite
SpriteID sprite
The 'real' sprite.
Definition: gfx_type.h:23
AirportTileScopeResolver::st
struct Station * st
Station of the airport for which the callback is run, or nullptr for build gui.
Definition: newgrf_airporttiles.h:22
ResolverObject
Interface for SpriteGroup-s to access the gamestate.
Definition: newgrf_spritegroup.h:307
INVALID_TILE
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:95
ResolverObject::grffile
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
Definition: newgrf_spritegroup.h:335
newgrf_animation_base.h
town.h
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
GetTerrainType
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 ...
Definition: newgrf_commons.cpp:331
CallbackID
CallbackID
List of implemented NewGRF callbacks.
Definition: newgrf_callbacks.h:20
BaseStation::owner
Owner owner
The owner of this station.
Definition: base_station_base.h:74
Debug
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Definition: debug.h:37
GetTownRadiusGroup
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Definition: town_cmd.cpp:2386
TileInfo::tileh
Slope tileh
Slope of the tile.
Definition: tile_cmd.h:46
OverrideManagerBase::invalid_id
uint16_t invalid_id
ID used to detected invalid entities.
Definition: newgrf_commons.h:199
AirportTileSpec::ResetAirportTiles
static void ResetAirportTiles()
This function initializes the tile array of AirportTileSpec.
Definition: newgrf_airporttiles.cpp:58
DrawTileSprites::ground
PalSpriteID ground
Palette and sprite for the ground.
Definition: sprite.h:59
AirportTileSpec
Defines the data structure of each individual tile of an airport.
Definition: newgrf_airporttiles.h:68
GRFFileProps::override
uint16_t override
id of the entity been replaced by
Definition: newgrf_commons.h:332
newgrf_airporttiles.h
CBID_AIRPTILE_ANIM_NEXT_FRAME
@ CBID_AIRPTILE_ANIM_NEXT_FRAME
Called to determine airport tile next animation frame.
Definition: newgrf_callbacks.h:239
GetStationTileRandomBits
byte GetStationTileRandomBits(Tile t)
Get the random bits of a station tile.
Definition: station_map.h:609
airporttiles.h
ResolverObject::root_spritegroup
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
Definition: newgrf_spritegroup.h:336
Station::airport
Airport airport
Tile area the airport covers.
Definition: station_base.h:456
GetAirportTileIDAtOffset
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...
Definition: newgrf_airporttiles.cpp:127
NUM_AIRPORTTILES
static const uint NUM_AIRPORTTILES
Total number of airport tiles.
Definition: airport.h:23
AirportTileSpec::GetByTile
static const AirportTileSpec * GetByTile(TileIndex tile)
Retrieve airport tile spec for the given airport tile.
Definition: newgrf_airporttiles.cpp:50
AirportTileResolverObject::GetDebugID
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
Definition: newgrf_airporttiles.cpp:229
AirportTileScopeResolver::GetRandomBits
uint32_t GetRandomBits() const override
Get a few random bits.
Definition: newgrf_airporttiles.cpp:201
IsTileOnWater
bool IsTileOnWater(Tile t)
Tests if the tile was built on water.
Definition: water_map.h:139
GetNearbyTileInformation
uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8)
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
Definition: newgrf_commons.cpp:429
safeguards.h
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:58
AnimationBase< AirportTileAnimationBase, AirportTileSpec, Station, int, GetAirportTileCallback, TileAnimationFrameAnimationHelper< Station > >::ChangeAnimationFrame
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.
Definition: newgrf_animation_base.h:124
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
OverrideManagerBase::AddEntityID
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.
Definition: newgrf_commons.cpp:109
stdafx.h
landscape.h
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
GRFFilePropsBase::local_id
uint16_t local_id
id defined by the grf file for this entity
Definition: newgrf_commons.h:318
ConvertBooleanCallback
bool ConvertBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
Converts a callback result into a boolean.
Definition: newgrf_commons.cpp:529
newgrf_spritegroup.h
DrawFoundation
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
Definition: landscape.cpp:427
DrawNewGRFTileSeq
void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32_t stage, PaletteID default_palette)
Draw NewGRF industrytile or house sprite layout.
Definition: sprite.h:124
GrfSpecFeature
GrfSpecFeature
Definition: newgrf.h:66
AirportTileResolverObject::tiles_scope
AirportTileScopeResolver tiles_scope
Scope resolver for the tiles.
Definition: newgrf_airporttiles.h:46
CALLBACK_FAILED
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
Definition: newgrf_callbacks.h:420
station_base.h
newgrf_sound.h
CBM_AIRT_DRAW_FOUNDATIONS
@ CBM_AIRT_DRAW_FOUNDATIONS
decides if default foundations need to be drawn
Definition: newgrf_callbacks.h:413
GRFFilePropsBase::spritegroup
const struct SpriteGroup * spritegroup[Tcnt]
pointer to the different sprites of the entity
Definition: newgrf_commons.h:320
_origin_airporttile_specs
static const AirportTileSpec _origin_airporttile_specs[]
All default airport tiles.
Definition: airporttiles.h:22
AirportTileScopeResolver::GetVariable
uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override
Get a variable value.
Definition: newgrf_airporttiles.cpp:162
CBID_AIRPTILE_ANIM_START_STOP
@ CBID_AIRPTILE_ANIM_START_STOP
Called for periodically starting or stopping the animation.
Definition: newgrf_callbacks.h:236
CBID_AIRPTILE_DRAW_FOUNDATIONS
@ CBID_AIRPTILE_DRAW_FOUNDATIONS
Called to determine the type (if any) of foundation to draw for an airport tile.
Definition: newgrf_callbacks.h:233
GetStationIndex
StationID GetStationIndex(Tile t)
Get StationID from a tile.
Definition: station_map.h:28
OrthogonalTileArea::tile
TileIndex tile
The base tile of the area.
Definition: tilearea_type.h:19
GetAirportGfx
StationGfx GetAirportGfx(Tile t)
Get the station graphics of this airport tile.
Definition: station_map.h:246
FOUNDATION_LEVELED
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
Definition: slope_type.h:95
AirportTileSpec::enabled
bool enabled
entity still available (by default true). newgrf can disable it, though
Definition: newgrf_airporttiles.h:73
MP_STATION
@ MP_STATION
A tile of a station.
Definition: tile_type.h:53
OverrideManagerBase::ResetOverride
void ResetOverride()
Resets the override, which is used while initializing game.
Definition: newgrf_commons.cpp:78
SpecializedStation< Station, false >::GetByTile
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
Definition: base_station_base.h:278
MAX_UVALUE
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
Definition: stdafx.h:388
GetNearbyAirportTileInformation
static uint32_t GetNearbyAirportTileInformation(byte parameter, TileIndex tile, StationID index, bool grf_version8)
Based on newhouses/newindustries equivalent, but adapted for airports.
Definition: newgrf_airporttiles.cpp:110
GetRelativePosition
uint32_t GetRelativePosition(TileIndex tile, TileIndex ind_tile)
This is the position of the tile relative to the northernmost tile of the industry.
Definition: newgrf_industrytiles.cpp:53
GetTranslatedAirportTileID
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
Do airporttile gfx ID translation for NewGRFs.
Definition: newgrf_airporttiles.cpp:96
AnimationBase< AirportTileAnimationBase, AirportTileSpec, Station, int, GetAirportTileCallback, TileAnimationFrameAnimationHelper< Station > >::AnimateTile
static void AnimateTile(const AirportTileSpec *spec, Station *obj, TileIndex tile, bool random_animation, int extra_data=0)
Animate a single tile.
Definition: newgrf_animation_base.h:45
BaseStation::random_bits
uint16_t random_bits
Random bits assigned to this station.
Definition: base_station_base.h:82
AnimationBase
Helper class for a unified approach to NewGRF animation.
Definition: newgrf_animation_base.h:36
SpriteGroup::Resolve
virtual const SpriteGroup * Resolve([[maybe_unused]] ResolverObject &object) const
Base sprite group resolver.
Definition: newgrf_spritegroup.h:61
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:300
GetAnimationFrame
byte GetAnimationFrame(Tile t)
Get the current animation frame.
Definition: tile_map.h:250
AirportTileAnimationBase
Helper class for animation control.
Definition: newgrf_airporttiles.cpp:283
GetNearbyTile
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axis axis)
Get the tile at the given offset.
Definition: newgrf_commons.cpp:406
NEW_AIRPORTTILE_OFFSET
static const uint NEW_AIRPORTTILE_OFFSET
offset of first newgrf airport tile
Definition: airport.h:24
PalSpriteID::pal
PaletteID pal
The palette (use PAL_NONE) if not needed)
Definition: gfx_type.h:24
TileInfo::tile
TileIndex tile
Tile index.
Definition: tile_cmd.h:47
OverrideManagerBase::max_offset
uint16_t max_offset
what is the length of the original entity's array of specs
Definition: newgrf_commons.h:196
AirportTileSpec::callback_mask
uint8_t callback_mask
Bitmask telling which grf callback is set.
Definition: newgrf_airporttiles.h:71
AirportTileResolverObject
Resolver for tiles of an airport.
Definition: newgrf_airporttiles.h:45
IsTileType
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Definition: tile_map.h:150
ScopeResolver::ro
ResolverObject & ro
Surrounding resolver object.
Definition: newgrf_spritegroup.h:289
AirpAnimationTrigger
AirpAnimationTrigger
Animation triggers for airport tiles.
Definition: newgrf_animation_type.h:46
GRFFilePropsBase::grffile
const struct GRFFile * grffile
grf file that introduced this entity
Definition: newgrf_commons.h:319
CBID_AIRPTILE_ANIMATION_SPEED
@ CBID_AIRPTILE_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Definition: newgrf_callbacks.h:242
SLOPE_FLAT
@ SLOPE_FLAT
a flat tile
Definition: slope_type.h:49
AirportTileSpec::Get
static const AirportTileSpec * Get(StationGfx gfx)
Retrieve airport tile spec for the given airport tile.
Definition: newgrf_airporttiles.cpp:37
AirportTileSpec::grf_prop
GRFFileProps grf_prop
properties related the the grf file
Definition: newgrf_airporttiles.h:74
TileLayoutSpriteGroup::ProcessRegisters
const DrawTileSprites * ProcessRegisters(uint8_t *stage) const
Process registers and the construction stage into the sprite layout.
Definition: newgrf_spritegroup.cpp:289
AirportTileResolverObject::GetFeature
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
Definition: newgrf_airporttiles.cpp:224
SpriteGroup
Definition: newgrf_spritegroup.h:57
IsAirport
bool IsAirport(Tile t)
Is this station tile an airport?
Definition: station_map.h:157
AT_DUMMY
@ AT_DUMMY
Dummy airport.
Definition: airport.h:43
DrawGroundSprite
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.
Definition: viewport.cpp:589
debug.h
AirportTileOverrideManager
Definition: newgrf_commons.h:267
TileLayoutSpriteGroup
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
Definition: newgrf_spritegroup.h:259
AirportTileSpec::animation
AnimationInfo animation
Information about the animation.
Definition: newgrf_airporttiles.h:69
AirportTileCallbackMask
AirportTileCallbackMask
Callback masks for airport tiles.
Definition: newgrf_callbacks.h:409
CBM_AIRT_ANIM_SPEED
@ CBM_AIRT_ANIM_SPEED
decides animation speed
Definition: newgrf_callbacks.h:411
HasBit
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103