diff options
author | glx <glx@openttd.org> | 2019-12-15 05:55:59 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-12-21 20:13:03 +0100 |
commit | ddabfed1cd3efa9ee229214207a60fc7cb3e0641 (patch) | |
tree | 824eddd3155d04363864731a43a6863cd7fbd2a3 /src/station.cpp | |
parent | 3a14cea068d130e11b5d9dde11d4451dd7dec453 (diff) | |
download | openttd-ddabfed1cd3efa9ee229214207a60fc7cb3e0641.tar.xz |
Codechange: Replace station related FOR_ALL with range-based for loops
Diffstat (limited to 'src/station.cpp')
-rw-r--r-- | src/station.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/station.cpp b/src/station.cpp index 59fee57da..2a343d798 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -42,8 +42,7 @@ StationKdtree _station_kdtree(Kdtree_StationXYFunc); void RebuildStationKdtree() { std::vector<StationID> stids; - BaseStation *st; - FOR_ALL_STATIONS(st) { + for (const Station *st : Station::Iterate()) { stids.push_back(st->index); } _station_kdtree.Build(stids.begin(), stids.end()); @@ -480,8 +479,7 @@ void Station::RecomputeCatchment() */ /* static */ void Station::RecomputeCatchmentForAll() { - Station *st; - FOR_ALL_STATIONS(st) { st->RecomputeCatchment(); } + for (Station *st : Station::Iterate()) { st->RecomputeCatchment(); } } /************************************************************************/ @@ -660,8 +658,7 @@ Money AirportMaintenanceCost(Owner owner) { Money total_cost = 0; - const Station *st; - FOR_ALL_STATIONS(st) { + for (const Station *st : Station::Iterate()) { if (st->owner == owner && (st->facilities & FACIL_AIRPORT)) { total_cost += _price[PR_INFRASTRUCTURE_AIRPORT] * st->airport.GetSpec()->maintenance_cost; } |