From 377fb5ec30b40f337d0daeb1e55ddb098503879c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 15 Oct 2022 17:02:30 +0100 Subject: [PATCH] CheckCaches: Check town cache fields individually Do not compare viewport sign cache --- src/openttd.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/openttd.cpp b/src/openttd.cpp index cea1bd8258..38f4a52237 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1499,8 +1499,20 @@ void CheckCaches(bool force_check, std::function log, CheckC uint i = 0; for (Town *t : Town::Iterate()) { - if (MemCmpT(old_town_caches.data() + i, &t->cache) != 0) { - CCLOG("town cache mismatch: town %i", (int)t->index); + if (old_town_caches[i].num_houses != t->cache.num_houses) { + CCLOG("town cache num_houses mismatch: town %i, (old size: %u, new size: %u)", (int)t->index, old_town_caches[i].num_houses, t->cache.num_houses); + } + if (old_town_caches[i].population != t->cache.population) { + CCLOG("town cache population mismatch: town %i, (old size: %u, new size: %u)", (int)t->index, old_town_caches[i].population, t->cache.population); + } + if (old_town_caches[i].part_of_subsidy != t->cache.part_of_subsidy) { + CCLOG("town cache population mismatch: town %i, (old size: %u, new size: %u)", (int)t->index, old_town_caches[i].part_of_subsidy, t->cache.part_of_subsidy); + } + if (MemCmpT(old_town_caches[i].squared_town_zone_radius, t->cache.squared_town_zone_radius, lengthof(t->cache.squared_town_zone_radius)) != 0) { + CCLOG("town cache squared_town_zone_radius mismatch: town %i", (int)t->index); + } + if (MemCmpT(&old_town_caches[i].building_counts, &t->cache.building_counts) != 0) { + CCLOG("town cache building_counts mismatch: town %i", (int)t->index); } if (old_town_stations_nears[i] != t->stations_near) { CCLOG("town stations_near mismatch: town %i, (old size: %u, new size: %u)", (int)t->index, (uint)old_town_stations_nears[i].size(), (uint)t->stations_near.size());