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()
{
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);
const TileIndex *ti = _animated_tiles.Begin();
while (ti < _animated_tiles.End()) {
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,
* 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