De-virtualise tile animation calls

This commit is contained in:
Jonathan G Rennison
2019-01-19 04:28:51 +00:00
parent f763b5d5e0
commit 08998d95ba
6 changed files with 30 additions and 12 deletions

View File

@@ -51,12 +51,37 @@ void AddAnimatedTile(TileIndex tile)
*/ */
void AnimateAnimatedTiles() void AnimateAnimatedTiles()
{ {
extern void AnimateTile_Town(TileIndex tile);
extern void AnimateTile_Station(TileIndex tile);
extern void AnimateTile_Industry(TileIndex tile);
extern void AnimateTile_Object(TileIndex tile);
PerformanceAccumulator framerate(PFE_GL_LANDSCAPE); PerformanceAccumulator framerate(PFE_GL_LANDSCAPE);
const TileIndex *ti = _animated_tiles.Begin(); const TileIndex *ti = _animated_tiles.Begin();
while (ti < _animated_tiles.End()) { while (ti < _animated_tiles.End()) {
const TileIndex curr = *ti; const TileIndex curr = *ti;
AnimateTile(curr); switch (GetTileType(curr)) {
case MP_HOUSE:
AnimateTile_Town(curr);
break;
case MP_STATION:
AnimateTile_Station(curr);
break;
case MP_INDUSTRY:
AnimateTile_Industry(curr);
break;
case MP_OBJECT:
AnimateTile_Object(curr);
break;
default:
NOT_REACHED();
}
/* During the AnimateTile call, DeleteAnimatedTile could have been called, /* During the AnimateTile call, DeleteAnimatedTile could have been called,
* deleting an element we've already processed and pushing the rest one * deleting an element we've already processed and pushing the rest one
* slot to the left. We can detect this by checking whether the index * slot to the left. We can detect this by checking whether the index

View File

@@ -540,7 +540,7 @@ static bool TransportIndustryGoods(TileIndex tile)
} }
static void AnimateTile_Industry(TileIndex tile) void AnimateTile_Industry(TileIndex tile)
{ {
IndustryGfx gfx = GetIndustryGfx(tile); IndustryGfx gfx = GetIndustryGfx(tile);

View File

@@ -696,7 +696,7 @@ static bool ClickTile_Object(TileIndex tile)
return true; return true;
} }
static void AnimateTile_Object(TileIndex tile) void AnimateTile_Object(TileIndex tile)
{ {
AnimateNewObjectTile(tile); AnimateNewObjectTile(tile);
} }

View File

@@ -3316,7 +3316,7 @@ static void TileLoop_Station(TileIndex tile)
} }
static void AnimateTile_Station(TileIndex tile) void AnimateTile_Station(TileIndex tile)
{ {
if (HasStationRail(tile)) { if (HasStationRail(tile)) {
AnimateStationTile(tile); AnimateStationTile(tile);

View File

@@ -182,13 +182,6 @@ static inline void AddProducedCargo(TileIndex tile, CargoArray &produced)
proc(tile, produced); proc(tile, produced);
} }
static inline void AnimateTile(TileIndex tile)
{
AnimateTileProc *proc = _tile_type_procs[GetTileType(tile)]->animate_tile_proc;
assert(proc != NULL);
proc(tile);
}
static inline bool ClickTile(TileIndex tile) static inline bool ClickTile(TileIndex tile)
{ {
ClickTileProc *proc = _tile_type_procs[GetTileType(tile)]->click_tile_proc; ClickTileProc *proc = _tile_type_procs[GetTileType(tile)]->click_tile_proc;

View File

@@ -397,7 +397,7 @@ static Foundation GetFoundation_Town(TileIndex tile, Slope tileh)
* The newhouses animation supersedes regular ones * The newhouses animation supersedes regular ones
* @param tile TileIndex of the house to animate * @param tile TileIndex of the house to animate
*/ */
static void AnimateTile_Town(TileIndex tile) void AnimateTile_Town(TileIndex tile)
{ {
if (GetHouseType(tile) >= NEW_HOUSE_OFFSET) { if (GetHouseType(tile) >= NEW_HOUSE_OFFSET) {
AnimateNewHouseTile(tile); AnimateNewHouseTile(tile);