1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-20 19:02:41 +01:00

Codechange: Simplify Station::train_station iteration when marking tiles dirty. (#13003)

This commit is contained in:
Peter Nelson
2024-10-17 23:01:04 +01:00
committed by GitHub
parent ae4a723889
commit 2fda7d8297

View File

@@ -242,10 +242,7 @@ void Station::AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
*/
void Station::MarkTilesDirty(bool cargo_change) const
{
TileIndex tile = this->train_station.tile;
int w, h;
if (tile == INVALID_TILE) return;
if (this->train_station.tile == INVALID_TILE) return;
/* cargo_change is set if we're refreshing the tiles due to cargo moving
* around. */
@@ -256,14 +253,10 @@ void Station::MarkTilesDirty(bool cargo_change) const
if (this->speclist.empty()) return;
}
for (h = 0; h < train_station.h; h++) {
for (w = 0; w < train_station.w; w++) {
if (this->TileBelongsToRailStation(tile)) {
MarkTileDirtyByTile(tile);
}
tile += TileDiffXY(1, 0);
for (TileIndex tile : this->train_station) {
if (this->TileBelongsToRailStation(tile)) {
MarkTileDirtyByTile(tile);
}
tile += TileDiffXY(-w, 1);
}
}