diff options
author | rubidium <rubidium@openttd.org> | 2009-10-20 12:20:53 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-10-20 12:20:53 +0000 |
commit | 9696e3e39bcfa5092221e1db9d75769700f0482b (patch) | |
tree | 87659518e7abb1155c43c7d08ebff35b18904481 /src/openttd.cpp | |
parent | cfcf3159b2a4c20f2457c1ac360139c18617b93d (diff) | |
download | openttd-9696e3e39bcfa5092221e1db9d75769700f0482b.tar.xz |
(svn r17816) -Codechange: move the CargoList invalidation-after-saveload to the function that handles the CargoPackets instead of spreading it around over the saveload files. Also add some code to validate whether the caches are valid; to be removed later when no problems turn up
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index d4bb54a1c..dd7b3bd09 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -60,6 +60,7 @@ #include "highscore.h" #include "thread/thread.h" #include "base_station_base.h" +#include "station_base.h" #include "airport.h" #include "crashlog.h" @@ -1154,6 +1155,25 @@ void StateGameLoop() } } + /* Check whether the caches are still valid */ + Vehicle *v; + FOR_ALL_VEHICLES(v) { + byte buff[sizeof(VehicleCargoList)]; + memcpy(buff, &v->cargo, sizeof(VehicleCargoList)); + v->cargo.InvalidateCache(); + assert(memcmp(&v->cargo, buff, sizeof(VehicleCargoList)) == 0); + } + + Station *st; + FOR_ALL_STATIONS(st) { + for (CargoID c = 0; c < NUM_CARGO; c++) { + byte buff[sizeof(StationCargoList)]; + memcpy(buff, &st->goods[c].cargo, sizeof(StationCargoList)); + st->goods[c].cargo.InvalidateCache(); + assert(memcmp(&st->goods[c].cargo, buff, sizeof(StationCargoList)) == 0); + } + } + /* All these actions has to be done from OWNER_NONE * for multiplayer compatibility */ CompanyID old_company = _current_company; |