improve logging of network out of sync

This commit is contained in:
Tim Felgentreff 2022-02-19 12:49:24 +01:00
parent 662a3abea6
commit 01ae1b763d

View file

@ -298,8 +298,8 @@ CUDPSocket NetworkFildes; /// Network file descriptor
static unsigned long NetworkLastFrame[PlayerMax]; /// Last frame received packet
static unsigned long NetworkLastCycle[PlayerMax]; /// Last cycle received packet
static int NetworkSyncSeeds[256]; /// Network sync seeds.
static int NetworkSyncHashs[256]; /// Network sync hashs.
static unsigned int NetworkSyncSeeds[256]; /// Network sync seeds.
static unsigned int NetworkSyncHashs[256]; /// Network sync hashs.
static CNetworkCommandQueue NetworkIn[256][PlayerMax][MaxNetworkCommands]; /// Per-player network packet input queue
static std::deque<CNetworkCommandQueue> CommandsIn; /// Network command input queue
static std::deque<CNetworkCommandQueue> MsgCommandsIn; /// Network message input queue
@ -917,8 +917,8 @@ static void NetworkExecCommand_Sync(const CNetworkCommandQueue &ncq)
CNetworkCommandSync nc;
nc.Deserialize(&ncq.Data[0]);
const unsigned long gameNetCycle = GameCycle;
const int syncSeed = nc.syncSeed;
const int syncHash = nc.syncHash;
const unsigned int syncSeed = nc.syncSeed;
const unsigned int syncHash = nc.syncHash;
if (syncSeed != NetworkSyncSeeds[gameNetCycle & 0xFF]
|| syncHash != NetworkSyncHashs[gameNetCycle & 0xFF]) {
@ -931,9 +931,9 @@ static void NetworkExecCommand_Sync(const CNetworkCommandQueue &ncq)
gameInSync = false;
SetGamePaused(true);
}
DebugPrint("\nNetwork out of sync %x!=%x! %d!=%d! Cycle %lu\n\n" _C_
DebugPrint("\nNetwork out of sync seed: %X!=%X , hash: %X!=%X Cycle %lu\n\n" _C_
syncSeed _C_ NetworkSyncSeeds[gameNetCycle & 0xFF] _C_
syncHash _C_ NetworkSyncHashs[gameNetCycle & 0xFF] _C_ GameCycle);
syncHash _C_ NetworkSyncHashs[gameNetCycle & 0xFF] _C_ GameCycle);
} else {
gameInSync = true;
}