diff options
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 86b3aedae..deed5161b 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2185,10 +2185,10 @@ uint8 GetAirportNoiseLevelForDistance(const AirportSpec *as, uint distance) */ Town *AirportGetNearestTown(const AirportSpec *as, const TileIterator &it, uint &mindist) { - Town *t, *nearest = nullptr; + Town *nearest = nullptr; uint add = as->size_x + as->size_y - 2; // GetMinimalAirportDistanceToTile can differ from DistanceManhattan by this much mindist = UINT_MAX - add; // prevent overflow - FOR_ALL_TOWNS(t) { + for (Town *t : Town::Iterate()) { if (DistanceManhattan(t->xy, it) < mindist + add) { // avoid calling GetMinimalAirportDistanceToTile too often TileIterator *copy = it.Clone(); uint dist = GetMinimalAirportDistanceToTile(*copy, t->xy); @@ -2207,9 +2207,7 @@ Town *AirportGetNearestTown(const AirportSpec *as, const TileIterator &it, uint /** Recalculate the noise generated by the airports of each town */ void UpdateAirportsNoise() { - Town *t; - - FOR_ALL_TOWNS(t) t->noise_reached = 0; + for (Town *t : Town::Iterate()) t->noise_reached = 0; for (const Station *st : Station::Iterate()) { if (st->airport.tile != INVALID_TILE && st->airport.type != AT_OILRIG) { |