Go to the documentation of this file.
1 /* $Id: newgrf_airporttiles.h 27984 2018-03-11 13:19:41Z frosch $ */
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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 <>.
8  */
15 #include "airport.h"
16 #include "station_map.h"
17 #include "newgrf_animation_type.h"
18 #include "newgrf_commons.h"
19 #include "newgrf_spritegroup.h"
20 #include "station_base.h"
24  struct Station *st;
25  byte airport_id;
35  : ScopeResolver(ro), st(st), tile(tile)
36  {
37  assert(st != NULL);
38  this->airport_id = st->airport.type;
39  }
41  /* virtual */ uint32 GetRandomBits() const;
42  /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
43 };
50  CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
52  /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
53  {
54  switch (scope) {
55  case VSG_SCOPE_SELF: return &tiles_scope;
56  default: return ResolverObject::GetScope(scope, relative);
57  }
58  }
59 };
67  uint8 callback_mask;
69  bool enabled;
72  static const AirportTileSpec *Get(StationGfx gfx);
73  static const AirportTileSpec *GetByTile(TileIndex tile);
75  static void ResetAirportTiles();
77 private:
78  static AirportTileSpec tiles[NUM_AIRPORTTILES];
80  friend void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts);
81 };
84 void AnimateAirportTile(TileIndex tile);
85 void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
86 void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
87 bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts);
byte type
Type of this airport,.
Definition: station_base.h:309
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope)...
Tile information, used while rendering the tile.
Definition: tile_cmd.h:44
Maps accessors for stations.
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
Do airporttile gfx ID translation for NewGRFs.
ResolverObject & ro
Surrounding resolver object.
Interface for SpriteGroup-s to access the gamestate.
struct Station * st
Station of the airport for which the callback is run, or NULL for build gui.
Definitions related to NewGRF animation.
Set when using the callback resolve system, but not to resolve a callback.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0)
Get a resolver for the scope.
byte airport_id
Type of airport for which the callback is run.
Various declarations for airports.
Action 2 handling.
Resolver for tiles of an airport.
Data related to the handling of grf files.
bool enabled
entity still available (by default true). newgrf can disable it, though
static const uint NUM_AIRPORTTILES
Total number of airport tiles.
Definition: airport.h:25
StringID name
Tile Subname string, land information on this tile will give you "AirportName (TileSubname)".
uint8 animation_special_flags
Extra flags to influence the animation.
Invalid cargo type.
Definition: cargo_type.h:70
Resolved object itself.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:18
uint32 GetVariable(byte variable, uint32 parameter, bool *available) const
Get a variable value.
uint32 GetRandomBits() const
Get a few random bits.
byte StationGfx
Copy from station_map.h.
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0)
Get a resolver for the scope.
AnimationInfo animation
Information about the animation.
Defines the data structure of each individual tile of an airport.
uint8 callback_mask
Bitmask telling which grf callback is set.
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities...
TileIndex tile
Tile for the callback, only valid for airporttile callbacks.
AirportTileScopeResolver tiles_scope
Scope resolver for the tiles.
Information about animation.
Airport airport
Tile area the airport covers.
Definition: station_base.h:460
List of implemented NewGRF callbacks.
Scope resolver for handling the tiles of an airport.
AirportTileScopeResolver(ResolverObject &ro, const AirportTileSpec *ats, TileIndex tile, Station *st)
Constructor of the scope resolver specific for airport tiles.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
Base classes/functions for stations.
GRFFileProps grf_prop
properties related the the grf file
Station data structure.
Definition: station_base.h:446
Animation triggers for airport tiles.