(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
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user