diff options
author | glx <glx@openttd.org> | 2019-12-15 22:45:18 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-12-21 20:13:03 +0100 |
commit | 1f6b3a37f9c39adb22eb61d3153b0c62bfa20551 (patch) | |
tree | 15486a7d6bb1445f3d6f1cbf40f98c1552368c08 /src/newgrf.cpp | |
parent | 1c92ba8ebed55e5455d6f57508db8ce55071d6eb (diff) | |
download | openttd-1f6b3a37f9c39adb22eb61d3153b0c62bfa20551.tar.xz |
Codechange: Replace FOR_ALL_ENGINES with range-based for loops
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r-- | src/newgrf.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index ce1b2babe..a6a48b1ca 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -8555,8 +8555,7 @@ void ResetNewGRFData() _gted = CallocT<GRFTempEngineData>(Engine::GetPoolSize()); /* Fill rail type label temporary data for default trains */ - Engine *e; - FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) { + for (const Engine *e : Engine::IterateType(VEH_TRAIN)) { _gted[e->index].railtypelabel = GetRailTypeInfo(e->u.rail.railtype)->label; } @@ -8772,9 +8771,7 @@ static const CargoLabel * const _default_refitmasks[] = { */ static void CalculateRefitMasks() { - Engine *e; - - FOR_ALL_ENGINES(e) { + for (Engine *e : Engine::Iterate()) { EngineID engine = e->index; EngineInfo *ei = &e->info; bool only_defaultcargo; ///< Set if the vehicle shall carry only the default cargo @@ -8888,9 +8885,7 @@ static void FinaliseCanals() /** Check for invalid engines */ static void FinaliseEngineArray() { - Engine *e; - - FOR_ALL_ENGINES(e) { + for (Engine *e : Engine::Iterate()) { if (e->GetGRF() == nullptr) { const EngineIDMapping &eid = _engine_mngr[e->index]; if (eid.grfid != INVALID_GRFID || eid.internal_id != eid.substitute_id) { @@ -9684,8 +9679,7 @@ static void AfterLoadGRFs() InitRailTypes(); InitRoadTypes(); - Engine *e; - FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) { + for (Engine *e : Engine::IterateType(VEH_ROAD)) { if (_gted[e->index].rv_max_speed != 0) { /* Set RV maximum speed from the mph/0.8 unit value */ e->u.road.max_speed = _gted[e->index].rv_max_speed * 4; @@ -9717,7 +9711,7 @@ static void AfterLoadGRFs() e->info.climates = 0; } - FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) { + for (Engine *e : Engine::IterateType(VEH_TRAIN)) { RailType railtype = GetRailTypeByLabel(_gted[e->index].railtypelabel); if (railtype == INVALID_RAILTYPE) { /* Rail type is not available, so disable this engine */ |