MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / CheckState

Method CheckState

src/openrct2/ReplayManager.cpp:795–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793
794#ifndef DISABLE_NETWORK
795 void CheckState()
796 {
797 uint32_t checksumIndex = _currentReplay->checksumIndex;
798
799 if (checksumIndex >= _currentReplay->checksums.size())
800 return;
801
802 const auto currentTicks = getGameState().currentTicks;
803
804 const auto& savedChecksum = _currentReplay->checksums[checksumIndex];
805 if (_currentReplay->checksums[checksumIndex].first == currentTicks)
806 {
807 _currentReplay->checksumIndex++;
808
809 EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum();
810 if (savedChecksum.second.raw != checksum.raw)
811 {
812 uint32_t replayTick = currentTicks - _currentReplay->tickStart;
813
814 // Detected different game state.
815 LOG_WARNING(
816 "Different sprite checksum at tick %u (Replay Tick: %u) ; Saved: %s, Current: %s", currentTicks,
817 replayTick, savedChecksum.second.ToString().c_str(), checksum.ToString().c_str());
818
819 _faultyChecksumIndex = checksumIndex;
820 }
821 else
822 {
823 // Good state.
824 LOG_VERBOSE(
825 "Good state at tick %u ; Saved: %s, Current: %s", currentTicks, savedChecksum.second.ToString().c_str(),
826 checksum.ToString().c_str());
827 }
828 }
829 }
830#endif // DISABLE_NETWORK
831
832 void ReplayCommands()

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected