Codechange: record cache warnings with a "warning" prefix (#12518)

This commit is contained in:
Patric Stout 2024-04-17 21:49:55 +02:00 committed by GitHub
parent a02da5476e
commit 1005c86c62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 18 deletions

View File

@ -1210,7 +1210,8 @@ void NetworkGameLoop()
assert(ret == 4);
check_sync_state = true;
} else if (strncmp(p, "msg: ", 5) == 0 || strncmp(p, "client: ", 8) == 0 ||
strncmp(p, "load: ", 6) == 0 || strncmp(p, "save: ", 6) == 0) {
strncmp(p, "load: ", 6) == 0 || strncmp(p, "save: ", 6) == 0 ||
strncmp(p, "warning: ", 9) == 0) {
/* A message that is not very important to the log playback, but part of the log. */
#ifndef DEBUG_FAILED_DUMP_COMMANDS
} else if (strncmp(p, "cmdf: ", 6) == 0) {

View File

@ -91,7 +91,7 @@ void AddChangedPersistentStorage(BasePersistentStorageArray *storage)
/* Discard all temporary changes */
for (auto &it : *_changed_storage_arrays) {
Debug(desync, 1, "Discarding persistent storage changes: Feature {}, GrfID {:08X}, Tile {}", it->feature, BSWAP32(it->grfid), it->tile);
Debug(desync, 2, "warning: discarding persistent storage changes: Feature {}, GrfID {:08X}, Tile {}", it->feature, BSWAP32(it->grfid), it->tile);
it->ClearChanges();
}
_changed_storage_arrays->clear();

View File

@ -1248,7 +1248,7 @@ static void CheckCaches()
uint i = 0;
for (Town *t : Town::Iterate()) {
if (MemCmpT(old_town_caches.data() + i, &t->cache) != 0) {
Debug(desync, 2, "town cache mismatch: town {}", t->index);
Debug(desync, 2, "warning: town cache mismatch: town {}", t->index);
}
i++;
}
@ -1262,7 +1262,7 @@ static void CheckCaches()
i = 0;
for (const Company *c : Company::Iterate()) {
if (MemCmpT(old_infrastructure.data() + i, &c->infrastructure) != 0) {
Debug(desync, 2, "infrastructure cache mismatch: company {}", c->index);
Debug(desync, 2, "warning: infrastructure cache mismatch: company {}", c->index);
}
i++;
}
@ -1318,23 +1318,23 @@ static void CheckCaches()
for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
FillNewGRFVehicleCache(u);
if (memcmp(&grf_cache[length], &u->grf_cache, sizeof(NewGRFCache)) != 0) {
Debug(desync, 2, "newgrf cache mismatch: type {}, vehicle {}, company {}, unit number {}, wagon {}", v->type, v->index, v->owner, v->unitnumber, length);
Debug(desync, 2, "warning: newgrf cache mismatch: type {}, vehicle {}, company {}, unit number {}, wagon {}", v->type, v->index, v->owner, v->unitnumber, length);
}
if (memcmp(&veh_cache[length], &u->vcache, sizeof(VehicleCache)) != 0) {
Debug(desync, 2, "vehicle cache mismatch: type {}, vehicle {}, company {}, unit number {}, wagon {}", v->type, v->index, v->owner, v->unitnumber, length);
Debug(desync, 2, "warning: vehicle cache mismatch: type {}, vehicle {}, company {}, unit number {}, wagon {}", v->type, v->index, v->owner, v->unitnumber, length);
}
switch (u->type) {
case VEH_TRAIN:
if (memcmp(&gro_cache[length], &Train::From(u)->gcache, sizeof(GroundVehicleCache)) != 0) {
Debug(desync, 2, "train ground vehicle cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
Debug(desync, 2, "warning: train ground vehicle cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
}
if (memcmp(&tra_cache[length], &Train::From(u)->tcache, sizeof(TrainCache)) != 0) {
Debug(desync, 2, "train cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
Debug(desync, 2, "warning: train cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
}
break;
case VEH_ROAD:
if (memcmp(&gro_cache[length], &RoadVehicle::From(u)->gcache, sizeof(GroundVehicleCache)) != 0) {
Debug(desync, 2, "road vehicle ground vehicle cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
Debug(desync, 2, "warning: road vehicle ground vehicle cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
}
break;
default:
@ -1384,11 +1384,11 @@ static void CheckCaches()
}
UpdateStationDockingTiles(st);
if (ta.tile != st->docking_station.tile || ta.w != st->docking_station.w || ta.h != st->docking_station.h) {
Debug(desync, 2, "station docking mismatch: station {}, company {}", st->index, st->owner);
Debug(desync, 2, "warning: station docking mismatch: station {}, company {}", st->index, st->owner);
}
for (TileIndex tile : ta) {
if (docking_tiles[tile] != IsDockingTile(tile)) {
Debug(desync, 2, "docking tile mismatch: tile {}", tile);
Debug(desync, 2, "warning: docking tile mismatch: tile {}", tile);
}
}
}
@ -1399,7 +1399,7 @@ static void CheckCaches()
i = 0;
for (Station *st : Station::Iterate()) {
if (st->industries_near != old_station_industries_near[i]) {
Debug(desync, 2, "station industries near mismatch: station {}", st->index);
Debug(desync, 2, "warning: station industries near mismatch: station {}", st->index);
}
i++;
}
@ -1408,14 +1408,14 @@ static void CheckCaches()
i = 0;
for (Town *t : Town::Iterate()) {
if (t->stations_near != old_town_stations_near[i]) {
Debug(desync, 2, "town stations near mismatch: town {}", t->index);
Debug(desync, 2, "warning: town stations near mismatch: town {}", t->index);
}
i++;
}
i = 0;
for (Industry *ind : Industry::Iterate()) {
if (ind->stations_near != old_industry_stations_near[i]) {
Debug(desync, 2, "industry stations near mismatch: industry {}", ind->index);
Debug(desync, 2, "warning: industry stations near mismatch: industry {}", ind->index);
}
i++;
}

View File

@ -241,7 +241,7 @@ public:
pf2.DisableCache(true);
FindDepotData result2 = pf2.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty);
if (result1.tile != result2.tile || (result1.reverse != result2.reverse)) {
Debug(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [{}, {}]",
Debug(desync, 2, "warning: FindNearestDepotTwoWay cache mismatch: {} vs {}",
result1.tile != INVALID_TILE ? "T" : "F",
result2.tile != INVALID_TILE ? "T" : "F");
DumpState(pf1, pf2);
@ -325,7 +325,7 @@ public:
pf2.DisableCache(true);
result1 = pf2.FindNearestSafeTile(v, t1, td, override_railtype, false);
if (result1 != result2) {
Debug(desync, 2, "CACHE ERROR: FindSafeTile() = [{}, {}]", result2 ? "T" : "F", result1 ? "T" : "F");
Debug(desync, 2, "warning: FindSafeTile cache mismatch: {} vs {}", result2 ? "T" : "F", result1 ? "T" : "F");
DumpState(pf1, pf2);
}
}
@ -409,7 +409,7 @@ public:
pf2.DisableCache(true);
Trackdir result2 = pf2.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target, dest);
if (result1 != result2) {
Debug(desync, 2, "CACHE ERROR: ChooseRailTrack() = [{}, {}]", result1, result2);
Debug(desync, 2, "warning: ChooseRailTrack cache mismatch: {} vs {}", result1, result2);
DumpState(pf1, pf2);
}
}
@ -476,7 +476,7 @@ public:
pf2.DisableCache(true);
bool result2 = pf2.CheckReverseTrain(v, t1, td1, t2, td2, reverse_penalty);
if (result1 != result2) {
Debug(desync, 2, "CACHE ERROR: CheckReverseTrain() = [{}, {}]", result1 ? "T" : "F", result2 ? "T" : "F");
Debug(desync, 2, "warning: CheckReverseTrain cache mismatch: {} vs {}", result1 ? "T" : "F", result2 ? "T" : "F");
DumpState(pf1, pf2);
}
}