From 830af8ee77bbbedb23f4caa53c8b47c20235f1b2 Mon Sep 17 00:00:00 2001 From: yexo Date: Sun, 17 Jan 2010 14:22:07 +0000 Subject: (svn r18845) -Codechange: introduce AirportTileSpec and use it for animation --- src/station_cmd.cpp | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'src/station_cmd.cpp') 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); } } } -- cgit v1.2.3-54-g00ecf