* Add the given tile to the animated tile table (if it does not exist yet). * @param tile the tile to make animated * @param mark_dirty whether to also mark the tile dirty. */
| 54 | * @param mark_dirty whether to also mark the tile dirty. |
| 55 | */ |
| 56 | void AddAnimatedTile(TileIndex tile, bool mark_dirty) |
| 57 | { |
| 58 | if (mark_dirty) MarkTileDirtyByTile(tile); |
| 59 | |
| 60 | const AnimatedTileState state = GetAnimatedTileState(tile); |
| 61 | |
| 62 | /* Tile is already animated so nothing needs to happen. */ |
| 63 | if (state == AnimatedTileState::Animated) return; |
| 64 | |
| 65 | /* Tile has no previous animation state, so add to the tile list. If the state is anything |
| 66 | * other than None (e.g. Deleted) then the tile will still be in the list and does not need to be added again. */ |
| 67 | if (state == AnimatedTileState::None) _animated_tiles.push_back(tile); |
| 68 | |
| 69 | SetAnimatedTileState(tile, AnimatedTileState::Animated); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Animate all tiles in the animated tile list, i.e.\ call AnimateTile on them. |
no test coverage detected