Codechange: Don't mark animated tiles dirty if frame is not changed.

If animation is continued but the animation frame has not changed then there is no need to mark the tile for refresh.

Loosely backport from JGRPP.
This commit is contained in:
Peter Nelson
2024-08-01 21:14:41 +01:00
committed by Peter Nelson
parent 8754846901
commit 1ff35cb6f9
4 changed files with 21 additions and 15 deletions
+6 -7
View File
@@ -168,16 +168,14 @@ void BaseStation::PostDestructor(size_t)
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
}
void BaseStation::SetRoadStopTileData(TileIndex tile, uint8_t data, bool animation)
bool BaseStation::SetRoadStopTileData(TileIndex tile, uint8_t data, bool animation)
{
for (RoadStopTileData &tile_data : this->custom_roadstop_tile_data) {
if (tile_data.tile == tile) {
if (animation) {
tile_data.animation_frame = data;
} else {
tile_data.random_bits = data;
}
return;
uint8_t &v = animation ? tile_data.animation_frame : tile_data.random_bits;
if (v == data) return false;
v = data;
return true;
}
}
RoadStopTileData tile_data;
@@ -185,6 +183,7 @@ void BaseStation::SetRoadStopTileData(TileIndex tile, uint8_t data, bool animati
tile_data.animation_frame = animation ? data : 0;
tile_data.random_bits = animation ? 0 : data;
this->custom_roadstop_tile_data.push_back(tile_data);
return data != 0;
}
void BaseStation::RemoveRoadStopTileData(TileIndex tile)