summaryrefslogtreecommitdiff
path: root/src/saveload/cargopacket_sl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/saveload/cargopacket_sl.cpp')
-rw-r--r--src/saveload/cargopacket_sl.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/saveload/cargopacket_sl.cpp b/src/saveload/cargopacket_sl.cpp
index bb44c663f..e9476fd4b 100644
--- a/src/saveload/cargopacket_sl.cpp
+++ b/src/saveload/cargopacket_sl.cpp
@@ -21,14 +21,13 @@
/* static */ void CargoPacket::AfterLoad()
{
if (IsSavegameVersionBefore(SLV_44)) {
- Vehicle *v;
/* If we remove a station while cargo from it is still en route, payment calculation will assume
* 0, 0 to be the source of the cargo, resulting in very high payments usually. v->source_xy
* stores the coordinates, preserving them even if the station is removed. However, if a game is loaded
* where this situation exists, the cargo-source information is lost. in this case, we set the source
* to the current tile of the vehicle to prevent excessive profits
*/
- FOR_ALL_VEHICLES(v) {
+ for (const Vehicle *v : Vehicle::Iterate()) {
const CargoPacketList *packets = v->cargo.Packets();
for (VehicleCargoList::ConstIterator it(packets->begin()); it != packets->end(); it++) {
CargoPacket *cp = *it;
@@ -67,8 +66,7 @@
/* Only since version 68 we have cargo packets. Savegames from before used
* 'new CargoPacket' + cargolist.Append so their caches are already
* correct and do not need rebuilding. */
- Vehicle *v;
- FOR_ALL_VEHICLES(v) v->cargo.InvalidateCache();
+ for (Vehicle *v : Vehicle::Iterate()) v->cargo.InvalidateCache();
for (Station *st : Station::Iterate()) {
for (CargoID c = 0; c < NUM_CARGO; c++) st->goods[c].cargo.InvalidateCache();
@@ -76,8 +74,7 @@
}
if (IsSavegameVersionBefore(SLV_181)) {
- Vehicle *v;
- FOR_ALL_VEHICLES(v) v->cargo.KeepAll();
+ for (Vehicle *v : Vehicle::Iterate()) v->cargo.KeepAll();
}
}