Include company infrastructure totals in state checksum

This commit is contained in:
Jonathan G Rennison 2022-11-13 11:53:16 +00:00
parent 5e00d535bc
commit 6f963a1268
2 changed files with 23 additions and 4 deletions

View File

@ -35,7 +35,7 @@ extern SimpleChecksum64 _state_checksum;
inline void UpdateStateChecksum(uint64 input) inline void UpdateStateChecksum(uint64 input)
{ {
_state_checksum.Update(input); if (_networking) _state_checksum.Update(input);
} }
#ifdef RANDOM_DEBUG #ifdef RANDOM_DEBUG

View File

@ -1985,9 +1985,28 @@ void StateGameLoop()
CallWindowGameTickEvent(); CallWindowGameTickEvent();
NewsLoop(); NewsLoop();
for (Company *c : Company::Iterate()) { if (_networking) {
DEBUG_UPDATESTATECHECKSUM("Company: %u, Money: " OTTD_PRINTF64, c->index, (int64)c->money); for (Company *c : Company::Iterate()) {
UpdateStateChecksum(c->money); DEBUG_UPDATESTATECHECKSUM("Company: %u, Money: " OTTD_PRINTF64, c->index, (int64)c->money);
UpdateStateChecksum(c->money);
for (uint i = 0; i < ROADTYPE_END; i++) {
DEBUG_UPDATESTATECHECKSUM("Company: %u, road[%u]: %u", c->index, i, c->infrastructure.road[i]);
UpdateStateChecksum(c->infrastructure.road[i]);
}
for (uint i = 0; i < RAILTYPE_END; i++) {
DEBUG_UPDATESTATECHECKSUM("Company: %u, rail[%u]: %u", c->index, i, c->infrastructure.rail[i]);
UpdateStateChecksum(c->infrastructure.rail[i]);
}
DEBUG_UPDATESTATECHECKSUM("Company: %u, signal: %u, water: %u, station: %u, airport: %u",
c->index, c->infrastructure.signal, c->infrastructure.water, c->infrastructure.station, c->infrastructure.airport);
UpdateStateChecksum(c->infrastructure.signal);
UpdateStateChecksum(c->infrastructure.water);
UpdateStateChecksum(c->infrastructure.station);
UpdateStateChecksum(c->infrastructure.airport);
}
} }
cur_company.Restore(); cur_company.Restore();
} }