diff options
Diffstat (limited to 'src/saveload/cargopacket_sl.cpp')
-rw-r--r-- | src/saveload/cargopacket_sl.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/saveload/cargopacket_sl.cpp b/src/saveload/cargopacket_sl.cpp index 57081fc51..77ee2ca7e 100644 --- a/src/saveload/cargopacket_sl.cpp +++ b/src/saveload/cargopacket_sl.cpp @@ -33,7 +33,6 @@ cp->source_xy = Station::IsValidID(cp->source) ? Station::Get(cp->source)->xy : v->tile; cp->loaded_at_xy = cp->source_xy; } - v->cargo.InvalidateCache(); } /* Store position of the station where the goods come from, so there @@ -63,6 +62,19 @@ if (!Station::IsValidID(cp->source)) cp->source = INVALID_STATION; } } + + if (!CheckSavegameVersion(68)) { + /* 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(); + + Station *st; + FOR_ALL_STATIONS(st) { + for (CargoID c = 0; c < NUM_CARGO; c++) st->goods[c].cargo.InvalidateCache(); + } + } } /** |