(svn r23411) -Add: Company infrastructure counts for rail.

This commit is contained in:
michi_cc
2011-12-03 23:40:13 +00:00
parent 6083d6ffb4
commit d30fcd4e35
9 changed files with 255 additions and 4 deletions

View File

@@ -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;