diff options
author | yexo <yexo@openttd.org> | 2010-01-17 14:22:07 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-01-17 14:22:07 +0000 |
commit | 830af8ee77bbbedb23f4caa53c8b47c20235f1b2 (patch) | |
tree | c1ff6197676c450a2487b608dc646bcb3df7b3ae /src/station_cmd.cpp | |
parent | f920415752e3b9e4e18dcd602e535d0c9b49e5d8 (diff) | |
download | openttd-830af8ee77bbbedb23f4caa53c8b47c20235f1b2.tar.xz |
(svn r18845) -Codechange: introduce AirportTileSpec and use it for animation
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 3285482b4..ff3fd4b12 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2596,15 +2596,8 @@ static void TileLoop_Station(TileIndex tile) * hardcoded.....not good */ switch (GetStationType(tile)) { case STATION_AIRPORT: - switch (GetStationGfx(tile)) { - case GFX_RADAR_LARGE_FIRST: - case GFX_WINDSACK_FIRST : // for small airport - case GFX_RADAR_INTERNATIONAL_FIRST: - case GFX_RADAR_METROPOLITAN_FIRST: - case GFX_RADAR_DISTRICTWE_FIRST: // radar district W-E airport - case GFX_WINDSACK_INTERCON_FIRST : // for intercontinental airport - AddAnimatedTile(tile); - break; + if (AirportTileSpec::Get(GetStationGfx(tile))->anim_next != AIRPORTTILE_NOANIM) { + AddAnimatedTile(tile); } break; @@ -2623,35 +2616,17 @@ static void TileLoop_Station(TileIndex tile) static void AnimateTile_Station(TileIndex tile) { - struct AnimData { - StationGfx from; // first sprite - StationGfx to; // last sprite - byte delay; - }; - - static const AnimData data[] = { - { GFX_RADAR_LARGE_FIRST, GFX_RADAR_LARGE_LAST, 3 }, - { GFX_WINDSACK_FIRST, GFX_WINDSACK_LAST, 1 }, - { GFX_RADAR_INTERNATIONAL_FIRST, GFX_RADAR_INTERNATIONAL_LAST, 3 }, - { GFX_RADAR_METROPOLITAN_FIRST, GFX_RADAR_METROPOLITAN_LAST, 3 }, - { GFX_RADAR_DISTRICTWE_FIRST, GFX_RADAR_DISTRICTWE_LAST, 3 }, - { GFX_WINDSACK_INTERCON_FIRST, GFX_WINDSACK_INTERCON_LAST, 1 } - }; - if (HasStationRail(tile)) { AnimateStationTile(tile); return; } - StationGfx gfx = GetStationGfx(tile); - - for (const AnimData *i = data; i != endof(data); i++) { - if (i->from <= gfx && gfx <= i->to) { - if ((_tick_counter & i->delay) == 0) { - SetStationGfx(tile, gfx < i->to ? gfx + 1 : i->from); - MarkTileDirtyByTile(tile); - } - break; + if (IsAirport(tile)) { + const AirportTileSpec *ats = AirportTileSpec::Get(GetStationGfx(tile)); + uint16 mask = (1 << ats->animation_speed) - 1; + if (ats->anim_next != AIRPORTTILE_NOANIM && (_tick_counter & mask) == 0) { + SetStationGfx(tile, ats->anim_next); + MarkTileDirtyByTile(tile); } } } |