Add flags for mismatch type to client desync log

This commit is contained in:
Jonathan G Rennison
2019-08-20 20:47:17 +01:00
parent ec892879f4
commit 459a49cb24
7 changed files with 46 additions and 14 deletions

View File

@@ -288,13 +288,21 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
#else
if (_sync_seed_1 != _random.state[0] || _sync_state_checksum != _state_checksum.state) {
#endif
DesyncExtraInfo info;
if (_sync_seed_1 != _random.state[0]) info.flags |= DesyncExtraInfo::DEIF_RAND1;
#ifdef NETWORK_SEND_DOUBLE_SEED
if (_sync_seed_2 != _random.state[1]) info.flags |= DesyncExtraInfo::DEIF_RAND2;
info.flags |= DesyncExtraInfo::DEIF_DBL_RAND;
#endif
if (_sync_state_checksum != _state_checksum.state) info.flags |= DesyncExtraInfo::DEIF_STATE;
NetworkError(STR_NETWORK_ERROR_DESYNC);
DEBUG(desync, 1, "sync_err: date{%08x; %02x; %02x} {%x, " OTTD_PRINTFHEX64 "} != {%x, " OTTD_PRINTFHEX64 "}"
, _date, _date_fract, _tick_skip_counter, _sync_seed_1, _sync_state_checksum, _random.state[0], _state_checksum.state);
DEBUG(net, 0, "Sync error detected!");
std::string desync_log;
CrashLog::DesyncCrashLog(nullptr, &desync_log);
CrashLog::DesyncCrashLog(nullptr, &desync_log, info);
my_client->SendDesyncLog(desync_log);
my_client->ClientError(NETWORK_RECV_STATUS_DESYNC);
return false;