Codechange: Replace FOR_ALL_ROADSTOPS with range-based for loops

This commit is contained in:
glx 2019-12-17 19:11:24 +01:00 committed by Niels Martin Hansen
parent 514565fad6
commit b91abd3af9
3 changed files with 5 additions and 13 deletions

View File

@ -1221,8 +1221,7 @@ static void CheckCaches()
} }
/* Strict checking of the road stop cache entries */ /* Strict checking of the road stop cache entries */
const RoadStop *rs; for (const RoadStop *rs : RoadStop::Iterate()) {
FOR_ALL_ROADSTOPS(rs) {
if (IsStandardRoadStopTile(rs->xy)) continue; if (IsStandardRoadStopTile(rs->xy)) continue;
assert(rs->GetEntry(DIAGDIR_NE) != rs->GetEntry(DIAGDIR_NW)); assert(rs->GetEntry(DIAGDIR_NE) != rs->GetEntry(DIAGDIR_NW));

View File

@ -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 */ #endif /* ROADSTOP_BASE_H */

View File

@ -129,12 +129,11 @@ void AfterLoadStations()
void AfterLoadRoadStops() void AfterLoadRoadStops()
{ {
/* First construct the drive through entries */ /* First construct the drive through entries */
RoadStop *rs; for (RoadStop *rs : RoadStop::Iterate()) {
FOR_ALL_ROADSTOPS(rs) {
if (IsDriveThroughStopTile(rs->xy)) rs->MakeDriveThrough(); if (IsDriveThroughStopTile(rs->xy)) rs->MakeDriveThrough();
} }
/* And then rebuild the data in those entries */ /* 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; if (!HasBit(rs->status, RoadStop::RSSFB_BASE_ENTRY)) continue;
rs->GetEntry(DIAGDIR_NE)->Rebuild(rs); rs->GetEntry(DIAGDIR_NE)->Rebuild(rs);
@ -606,9 +605,7 @@ static void Ptrs_STNN()
static void Save_ROADSTOP() static void Save_ROADSTOP()
{ {
RoadStop *rs; for (RoadStop *rs : RoadStop::Iterate()) {
FOR_ALL_ROADSTOPS(rs) {
SlSetArrayIndex(rs->index); SlSetArrayIndex(rs->index);
SlObject(rs, _roadstop_desc); SlObject(rs, _roadstop_desc);
} }
@ -627,8 +624,7 @@ static void Load_ROADSTOP()
static void Ptrs_ROADSTOP() static void Ptrs_ROADSTOP()
{ {
RoadStop *rs; for (RoadStop *rs : RoadStop::Iterate()) {
FOR_ALL_ROADSTOPS(rs) {
SlObject(rs, _roadstop_desc); SlObject(rs, _roadstop_desc);
} }
} }