Codechange: Use range-for iteration.

This commit is contained in:
Peter Nelson
2023-05-07 12:09:54 +01:00
committed by PeterN
parent cef3a2570d
commit e6740046ee
22 changed files with 169 additions and 193 deletions

View File

@@ -336,8 +336,8 @@ Vehicle *FindVehiclesInRoadStop(Vehicle *v, void *data)
if (rv->state < RVSB_IN_ROAD_STOP) return nullptr;
/* Do not add duplicates! */
for (RVList::iterator it = rserh->vehicles.begin(); it != rserh->vehicles.end(); it++) {
if (rv == *it) return nullptr;
for (const auto &it : rserh->vehicles) {
if (rv == it) return nullptr;
}
rserh->vehicles.push_back(rv);
@@ -367,8 +367,8 @@ void RoadStop::Entry::Rebuild(const RoadStop *rs, int side)
}
this->occupied = 0;
for (RVList::iterator it = rserh.vehicles.begin(); it != rserh.vehicles.end(); it++) {
this->occupied += (*it)->gcache.cached_total_length;
for (const auto &it : rserh.vehicles) {
this->occupied += it->gcache.cached_total_length;
}
}