diff options
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; |