summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index d20a2c33a..520589b8e 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1115,6 +1115,22 @@ void SwitchToMode(SwitchMode new_mode)
*/
static void CheckCaches()
{
+ /* Check company infrastructure cache. */
+ SmallVector<CompanyInfrastructure, 4> old_infrastructure;
+ Company *c;
+ FOR_ALL_COMPANIES(c) MemCpyT(old_infrastructure.Append(), &c->infrastructure);
+
+ extern void AfterLoadCompanyStats();
+ AfterLoadCompanyStats();
+
+ uint i = 0;
+ FOR_ALL_COMPANIES(c) {
+ if (MemCmpT(old_infrastructure.Get(i), &c->infrastructure) != 0) {
+ DEBUG(desync, 2, "infrastructure cache mismatch: company %i", c->index);
+ }
+ i++;
+ }
+
/* Return here so it is easy to add checks that are run
* always to aid testing of caches. */
if (_debug_desync_level <= 1) return;