diff options
author | glx22 <glx@openttd.org> | 2021-05-12 16:45:28 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-05-13 00:13:54 +0200 |
commit | 38c97e14926f4bc538c20b24f8a3decdef1668f9 (patch) | |
tree | 2138fa9979f463c5b946653c23313fbb977be652 /src/station.cpp | |
parent | 5bd81448539b63519d70ba85d4833e446f0597fe (diff) | |
download | openttd-38c97e14926f4bc538c20b24f8a3decdef1668f9.tar.xz |
Codechange: Replace TILE_AREA_LOOP with range-based for loops
Diffstat (limited to 'src/station.cpp')
-rw-r--r-- | src/station.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/station.cpp b/src/station.cpp index f859495d1..892677312 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -416,7 +416,7 @@ void Station::RecomputeCatchment() if (!_settings_game.station.serve_neutral_industries && this->industry != nullptr) { /* Station is associated with an industry, so we only need to deliver to that industry. */ this->catchment_tiles.Initialize(this->industry->location); - TILE_AREA_LOOP(tile, this->industry->location) { + for (TileIndex tile : this->industry->location) { if (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == this->industry->index) { this->catchment_tiles.SetTile(tile); } @@ -435,7 +435,7 @@ void Station::RecomputeCatchment() /* Loop finding all station tiles */ TileArea ta(TileXY(this->rect.left, this->rect.top), TileXY(this->rect.right, this->rect.bottom)); - TILE_AREA_LOOP(tile, ta) { + for (TileIndex tile : ta) { if (!IsTileType(tile, MP_STATION) || GetStationIndex(tile) != this->index) continue; uint r = GetTileCatchmentRadius(tile, this); @@ -443,7 +443,7 @@ void Station::RecomputeCatchment() /* This tile sub-loop doesn't need to test any tiles, they are simply added to the catchment set. */ TileArea ta2 = TileArea(tile, 1, 1).Expand(r); - TILE_AREA_LOOP(tile2, ta2) this->catchment_tiles.SetTile(tile2); + for (TileIndex tile2 : ta2) this->catchment_tiles.SetTile(tile2); } /* Search catchment tiles for towns and industries */ @@ -567,7 +567,7 @@ CommandCost StationRect::BeforeAddRect(TileIndex tile, int w, int h, StationRect /* static */ bool StationRect::ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a) { TileArea ta(TileXY(left_a, top_a), TileXY(right_a, bottom_a)); - TILE_AREA_LOOP(tile, ta) { + for (TileIndex tile : ta) { if (IsTileType(tile, MP_STATION) && GetStationIndex(tile) == st_id) return true; } |