mirror of https://github.com/OpenTTD/OpenTTD
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.pull/12883/head
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
|
* Add the given tile to the animated tile table (if it does not exist yet).
|
||||||
* on that table yet). Also increases the size of the table if necessary.
|
|
||||||
* @param tile the tile to make animated
|
* @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);
|
include(_animated_tiles, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "tile_type.h"
|
#include "tile_type.h"
|
||||||
|
|
||||||
void AddAnimatedTile(TileIndex tile);
|
void AddAnimatedTile(TileIndex tile, bool mark_dirty = true);
|
||||||
void DeleteAnimatedTile(TileIndex tile);
|
void DeleteAnimatedTile(TileIndex tile);
|
||||||
void AnimateAnimatedTiles();
|
void AnimateAnimatedTiles();
|
||||||
void InitializeAnimatedTiles();
|
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_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4:
|
||||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
|
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
|
||||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
|
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
|
||||||
AddAnimatedTile(tile);
|
AddAnimatedTile(tile, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ struct AnimationBase {
|
||||||
|
|
||||||
switch (callback & 0xFF) {
|
switch (callback & 0xFF) {
|
||||||
case 0xFD: /* Do nothing. */ break;
|
case 0xFD: /* Do nothing. */ break;
|
||||||
case 0xFE: AddAnimatedTile(tile); break;
|
case 0xFE: AddAnimatedTile(tile, false); break;
|
||||||
case 0xFF: DeleteAnimatedTile(tile); break;
|
case 0xFF: DeleteAnimatedTile(tile); break;
|
||||||
default:
|
default:
|
||||||
Tframehelper::Set(obj, tile, callback);
|
Tframehelper::Set(obj, tile, callback);
|
||||||
|
|
|
@ -2466,7 +2466,7 @@ static inline void ClearMakeHouseTile(TileIndex tile, Town *t, uint8_t counter,
|
||||||
|
|
||||||
IncreaseBuildingCount(t, type);
|
IncreaseBuildingCount(t, type);
|
||||||
MakeHouseTile(tile, t->index, counter, stage, type, random_bits);
|
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);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue