1
0
Fork 0

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

pull/13006/head
Peter Nelson 2024-10-17 23:01:04 +01:00 committed by GitHub
parent ae4a723889
commit 2fda7d8297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 11 deletions

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);
}
}