mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Codechange: Allow adding to animated tile list without marking dirty.
This avoids redundant tile refreshes when the caller has already marked a tile dirty, or knows it does not need refreshing. Loosely backported from JGRPP.
This commit is contained in:
parent
79369a886a
commit
8754846901
@ -32,13 +32,13 @@ void DeleteAnimatedTile(TileIndex tile)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given tile to the animated tile table (if it does not exist
|
||||
* on that table yet). Also increases the size of the table if necessary.
|
||||
* 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.
|
||||
*/
|
||||
void AddAnimatedTile(TileIndex tile)
|
||||
void AddAnimatedTile(TileIndex tile, bool mark_dirty)
|
||||
{
|
||||
MarkTileDirtyByTile(tile);
|
||||
if (mark_dirty) MarkTileDirtyByTile(tile);
|
||||
include(_animated_tiles, tile);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "tile_type.h"
|
||||
|
||||
void AddAnimatedTile(TileIndex tile);
|
||||
void AddAnimatedTile(TileIndex tile, bool mark_dirty = true);
|
||||
void DeleteAnimatedTile(TileIndex tile);
|
||||
void AnimateAnimatedTiles();
|
||||
void InitializeAnimatedTiles();
|
||||
|
@ -800,7 +800,7 @@ static void MakeIndustryTileBigger(TileIndex tile)
|
||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4:
|
||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
|
||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
|
||||
AddAnimatedTile(tile);
|
||||
AddAnimatedTile(tile, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ struct AnimationBase {
|
||||
|
||||
switch (callback & 0xFF) {
|
||||
case 0xFD: /* Do nothing. */ break;
|
||||
case 0xFE: AddAnimatedTile(tile); break;
|
||||
case 0xFE: AddAnimatedTile(tile, false); break;
|
||||
case 0xFF: DeleteAnimatedTile(tile); break;
|
||||
default:
|
||||
Tframehelper::Set(obj, tile, callback);
|
||||
|
@ -2466,7 +2466,7 @@ static inline void ClearMakeHouseTile(TileIndex tile, Town *t, uint8_t counter,
|
||||
|
||||
IncreaseBuildingCount(t, type);
|
||||
MakeHouseTile(tile, t->index, counter, stage, type, random_bits);
|
||||
if (HouseSpec::Get(type)->building_flags & BUILDING_IS_ANIMATED) AddAnimatedTile(tile);
|
||||
if (HouseSpec::Get(type)->building_flags & BUILDING_IS_ANIMATED) AddAnimatedTile(tile, false);
|
||||
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user