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/saveload/station_sl.cpp | |
parent | 3a14cea068d130e11b5d9dde11d4451dd7dec453 (diff) | |
download | openttd-ddabfed1cd3efa9ee229214207a60fc7cb3e0641.tar.xz |
Codechange: Replace station related FOR_ALL with range-based for loops
Diffstat (limited to 'src/saveload/station_sl.cpp')
-rw-r--r-- | src/saveload/station_sl.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index ac38bb0cf..7b091e2f1 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -57,8 +57,7 @@ void MoveBuoysToWaypoints() } /* Now make the stations waypoints */ - Station *st; - FOR_ALL_STATIONS(st) { + for (Station *st : Station::Iterate()) { if ((st->had_vehicle_of_type & HVOT_WAYPOINT) == 0) continue; StationID index = st->index; @@ -109,8 +108,7 @@ void MoveBuoysToWaypoints() void AfterLoadStations() { /* Update the speclists of all stations to point to the currently loaded custom stations. */ - BaseStation *st; - FOR_ALL_BASE_STATIONS(st) { + for (BaseStation *st : BaseStation::Iterate()) { for (uint i = 0; i < st->num_specs; i++) { if (st->speclist[i].grfid == 0) continue; @@ -376,8 +374,7 @@ static void Ptrs_STNS() if (!IsSavegameVersionBefore(SLV_123)) return; uint num_cargo = IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO; - Station *st; - FOR_ALL_STATIONS(st) { + for (Station *st : Station::Iterate()) { if (!IsSavegameVersionBefore(SLV_68)) { for (CargoID i = 0; i < num_cargo; i++) { GoodsEntry *ge = &st->goods[i]; @@ -514,9 +511,8 @@ static void RealSave_STNN(BaseStation *bst) static void Save_STNN() { - BaseStation *st; /* Write the stations */ - FOR_ALL_BASE_STATIONS(st) { + for (BaseStation *st : BaseStation::Iterate()) { SlSetArrayIndex(st->index); SlAutolength((AutolengthProc*)RealSave_STNN, st); } @@ -588,8 +584,7 @@ static void Ptrs_STNN() if (IsSavegameVersionBefore(SLV_123)) return; uint num_cargo = IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO; - Station *st; - FOR_ALL_STATIONS(st) { + for (Station *st : Station::Iterate()) { for (CargoID i = 0; i < num_cargo; i++) { GoodsEntry *ge = &st->goods[i]; if (IsSavegameVersionBefore(SLV_183)) { @@ -606,8 +601,7 @@ static void Ptrs_STNN() SlObject(st, _station_desc); } - Waypoint *wp; - FOR_ALL_WAYPOINTS(wp) { + for (Waypoint *wp : Waypoint::Iterate()) { SlObject(wp, _waypoint_desc); } } |