diff options
author | glx <glx@openttd.org> | 2019-12-17 19:11:24 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-12-21 20:13:03 +0100 |
commit | b91abd3af98cca51221210198e2c9607055c19b2 (patch) | |
tree | 5a19db5c977db576ba89d67873d59f3e10a4f00f /src | |
parent | 514565fad6d3a7e93a24b53b29eb901ef4f6a166 (diff) | |
download | openttd-b91abd3af98cca51221210198e2c9607055c19b2.tar.xz |
Codechange: Replace FOR_ALL_ROADSTOPS with range-based for loops
Diffstat (limited to 'src')
-rw-r--r-- | src/openttd.cpp | 3 | ||||
-rw-r--r-- | src/roadstop_base.h | 3 | ||||
-rw-r--r-- | src/saveload/station_sl.cpp | 12 |
3 files changed, 5 insertions, 13 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 63d5bf756..c7af56be1 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1221,8 +1221,7 @@ static void CheckCaches() } /* Strict checking of the road stop cache entries */ - const RoadStop *rs; - FOR_ALL_ROADSTOPS(rs) { + for (const RoadStop *rs : RoadStop::Iterate()) { if (IsStandardRoadStopTile(rs->xy)) continue; assert(rs->GetEntry(DIAGDIR_NE) != rs->GetEntry(DIAGDIR_NW)); diff --git a/src/roadstop_base.h b/src/roadstop_base.h index 475bd7cb8..768b54282 100644 --- a/src/roadstop_base.h +++ b/src/roadstop_base.h @@ -188,7 +188,4 @@ private: } }; -#define FOR_ALL_ROADSTOPS_FROM(var, start) FOR_ALL_ITEMS_FROM(RoadStop, roadstop_index, var, start) -#define FOR_ALL_ROADSTOPS(var) FOR_ALL_ROADSTOPS_FROM(var, 0) - #endif /* ROADSTOP_BASE_H */ diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index 2df8d8167..1d3612ae3 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -129,12 +129,11 @@ void AfterLoadStations() void AfterLoadRoadStops() { /* First construct the drive through entries */ - RoadStop *rs; - FOR_ALL_ROADSTOPS(rs) { + for (RoadStop *rs : RoadStop::Iterate()) { if (IsDriveThroughStopTile(rs->xy)) rs->MakeDriveThrough(); } /* And then rebuild the data in those entries */ - FOR_ALL_ROADSTOPS(rs) { + for (RoadStop *rs : RoadStop::Iterate()) { if (!HasBit(rs->status, RoadStop::RSSFB_BASE_ENTRY)) continue; rs->GetEntry(DIAGDIR_NE)->Rebuild(rs); @@ -606,9 +605,7 @@ static void Ptrs_STNN() static void Save_ROADSTOP() { - RoadStop *rs; - - FOR_ALL_ROADSTOPS(rs) { + for (RoadStop *rs : RoadStop::Iterate()) { SlSetArrayIndex(rs->index); SlObject(rs, _roadstop_desc); } @@ -627,8 +624,7 @@ static void Load_ROADSTOP() static void Ptrs_ROADSTOP() { - RoadStop *rs; - FOR_ALL_ROADSTOPS(rs) { + for (RoadStop *rs : RoadStop::Iterate()) { SlObject(rs, _roadstop_desc); } } |