diff options
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r-- | src/saveload/afterload.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index bcfa76885..0e663ee1c 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -535,6 +535,14 @@ bool AfterLoadGame() /* Connect front and rear engines of multiheaded trains */ ConnectMultiheadedTrains(); + /* Fix the CargoPackets *and* fix the caches of CargoLists. + * If this isn't done before Stations and especially Vehicles are + * running their AfterLoad we might get in trouble. In the case of + * vehicles we could give the wrong (cached) count of items in a + * vehicle which causes different results when getting their caches + * filled; and that could eventually lead to desyncs. */ + CargoPacket::AfterLoad(); + /* Update all vehicles */ AfterLoadVehicles(true); @@ -1226,8 +1234,6 @@ bool AfterLoadGame() } } - CargoPacket::AfterLoad(); - if (CheckSavegameVersion(45)) { Vehicle *v; /* Originally just the fact that some cargo had been paid for was @@ -1237,7 +1243,6 @@ bool AfterLoadGame() * amount that has been paid is stored. */ FOR_ALL_VEHICLES(v) { ClrBit(v->vehicle_flags, 2); - v->cargo.InvalidateCache(); } } |