(svn r21338) -Fix [FS#4272]: bogus cache mismatch warnings with desync debugging because some cache was invalidated but never reset

This commit is contained in:
rubidium
2010-11-27 21:09:41 +00:00
parent def0d71767
commit b46e57d364
3 changed files with 35 additions and 0 deletions

View File

@@ -1132,6 +1132,7 @@ static void CheckCaches()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
extern void FillNewGRFVehicleCache(const Vehicle *v);
if (v != v->First() || v->vehstatus & VS_CRASHED || !v->IsPrimaryVehicle()) continue;
uint length = 0;
@@ -1145,6 +1146,7 @@ static void CheckCaches()
length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
FillNewGRFVehicleCache(u);
grf_cache[length] = u->grf_cache;
veh_cache[length] = u->vcache;
switch (u->type) {
@@ -1171,6 +1173,7 @@ static void CheckCaches()
length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
FillNewGRFVehicleCache(u);
if (memcmp(&grf_cache[length], &u->grf_cache, sizeof(NewGRFCache)) != 0) {
DEBUG(desync, 2, "newgrf cache mismatch: type %i, vehicle %i, company %i, unit number %i, wagon %i", (int)v->type, v->index, (int)v->owner, v->unitnumber, length);
}