| 843 | } |
| 844 | |
| 845 | bool NetworkBase::CheckSRAND(uint32_t tick, uint32_t srand0) |
| 846 | { |
| 847 | // We have to wait for the map to be loaded first, ticks may match current loaded map. |
| 848 | if (!_clientMapLoaded) |
| 849 | return true; |
| 850 | |
| 851 | auto itTickData = _serverTickData.find(tick); |
| 852 | if (itTickData == std::end(_serverTickData)) |
| 853 | return true; |
| 854 | |
| 855 | const ServerTickData storedTick = itTickData->second; |
| 856 | _serverTickData.erase(itTickData); |
| 857 | |
| 858 | if (storedTick.srand0 != srand0) |
| 859 | { |
| 860 | LOG_INFO("Srand0 mismatch, client = %08X, server = %08X", srand0, storedTick.srand0); |
| 861 | return false; |
| 862 | } |
| 863 | |
| 864 | if (!storedTick.spriteHash.empty()) |
| 865 | { |
| 866 | EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum(); |
| 867 | std::string clientSpriteHash = checksum.ToString(); |
| 868 | if (clientSpriteHash != storedTick.spriteHash) |
| 869 | { |
| 870 | LOG_INFO( |
| 871 | "Sprite hash mismatch, client = %s, server = %s", clientSpriteHash.c_str(), storedTick.spriteHash.c_str()); |
| 872 | return false; |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | return true; |
| 877 | } |
| 878 | |
| 879 | bool NetworkBase::IsDesynchronised() const noexcept |
| 880 | { |
nothing calls this directly
no test coverage detected