OpenTTD: src/newgrf_airporttiles.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

newgrf_airporttiles.h
Go to the documentation of this file.
1 /* $Id: newgrf_airporttiles.h 27984 2018-03-11 13:19:41Z frosch $ */
2
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 <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef NEWGRF_AIRPORTTILES_H
13 #define NEWGRF_AIRPORTTILES_H
14
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"
21
23 struct AirportTileScopeResolver : public ScopeResolver {
24 struct Station *st;
25 byte airport_id;
26 TileIndex tile;
27
34 AirportTileScopeResolver(ResolverObject &ro, const AirportTileSpec *ats, TileIndex tile, Station *st)
35 : ScopeResolver(ro), st(st), tile(tile)
36 {
37 assert(st != NULL);
38 this->airport_id = st->airport.type;
39 }
40
41 /* virtual */ uint32 GetRandomBits() const;
42 /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
43 };
44
46 struct AirportTileResolverObject : public ResolverObject {
47 AirportTileScopeResolver tiles_scope;
48
49 AirportTileResolverObject(const AirportTileSpec *ats, TileIndex tile, Station *st,
50 CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
51
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 };
60
64 struct AirportTileSpec {
65 AnimationInfo animation;
66 StringID name;
67 uint8 callback_mask;
68 uint8 animation_special_flags;
69 bool enabled;
70 GRFFileProps grf_prop;
71
72 static const AirportTileSpec *Get(StationGfx gfx);
73 static const AirportTileSpec *GetByTile(TileIndex tile);
74
75 static void ResetAirportTiles();
76
77 private:
78 static AirportTileSpec tiles[NUM_AIRPORTTILES];
79
80 friend void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts);
81 };
82
83 StationGfx GetTranslatedAirportTileID(StationGfx gfx);
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);
88
89 #endif /* NEWGRF_AIRPORTTILES_H */