# newgrf_airporttiles.h

Go to the documentation of this file.

    00001 /* $Id: newgrf_airporttiles.h 26085 2013-11-24 14:41:19Z frosch $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef NEWGRF_AIRPORTTILES_H
    00013 #define NEWGRF_AIRPORTTILES_H
    00014
    00015 #include "airport.h"
    00016 #include "station_map.h"
    00017 #include "newgrf_animation_type.h"
    00018 #include "newgrf_commons.h"
    00019 #include "newgrf_spritegroup.h"
    00020
    00022 struct AirportTileScopeResolver : public ScopeResolver {
    00023   struct Station *st;
    00024   byte airport_id;
    00025   TileIndex tile;
    00026
    00027   AirportTileScopeResolver(ResolverObject &ro, const AirportTileSpec *ats, TileIndex tile, Station *st);
    00028
    00029   /* virtual */ uint32 GetRandomBits() const;
    00030   /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
    00031 };
    00032
    00034 struct AirportTileResolverObject : public ResolverObject {
    00035   AirportTileScopeResolver tiles_scope;
    00036
    00037   AirportTileResolverObject(const AirportTileSpec *ats, TileIndex tile, Station *st,
    00038       CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
    00039
    00040   /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
    00041   {
    00042     switch (scope) {
    00043       case VSG_SCOPE_SELF: return &tiles_scope;
    00044       default: return ResolverObject::GetScope(scope, relative);
    00045     }
    00046   }
    00047 };
    00048
    00052 struct AirportTileSpec {
    00053   AnimationInfo animation;
    00054   StringID name;
    00055   uint8 callback_mask;
    00056   uint8 animation_special_flags;
    00057   bool enabled;
    00058   GRFFileProps grf_prop;
    00059
    00060   static const AirportTileSpec *Get(StationGfx gfx);
    00061   static const AirportTileSpec *GetByTile(TileIndex tile);
    00062
    00063   static void ResetAirportTiles();
    00064
    00065 private:
    00066   static AirportTileSpec tiles[NUM_AIRPORTTILES];
    00067
    00068   friend void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts);
    00069 };
    00070
    00071 StationGfx GetTranslatedAirportTileID(StationGfx gfx);
    00072 void AnimateAirportTile(TileIndex tile);
    00073 void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
    00074 void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
    00075 bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts);
    00076
    00077 #endif /* NEWGRF_AIRPORTTILES_H */