print immediately when network goes out of sync

This commit is contained in:
Tim Felgentreff 2021-05-30 15:39:21 +02:00
parent 04603b87cd
commit 290a7904a4

View file

@ -911,6 +911,7 @@ void NetworkQuitGame()
static void NetworkExecCommand_Sync(const CNetworkCommandQueue &ncq) static void NetworkExecCommand_Sync(const CNetworkCommandQueue &ncq)
{ {
static bool gameInSync = true;
Assert((ncq.Type & 0x7F) == MessageSync); Assert((ncq.Type & 0x7F) == MessageSync);
CNetworkCommandSync nc; CNetworkCommandSync nc;
@ -924,13 +925,16 @@ static void NetworkExecCommand_Sync(const CNetworkCommandQueue &ncq)
// if it wasn't already, force enable debug output right now. maybe we get lucky ... // if it wasn't already, force enable debug output right now. maybe we get lucky ...
EnableDebugPrint = true; EnableDebugPrint = true;
EnableUnitDebug = true; EnableUnitDebug = true;
if ((gameNetCycle % (CYCLES_PER_SECOND * 5)) == 0) { if (gameInSync || (gameNetCycle % (CYCLES_PER_SECOND * 5)) == 0) {
// only print this message circa every 5 seconds... // only print this message circa every 5 seconds...
SetMessage("%s", _("Network out of sync")); SetMessage("%s", _("Network out of sync"));
gameInSync = false;
} }
DebugPrint("\nNetwork out of sync %x!=%x! %d!=%d! Cycle %lu\n\n" _C_ DebugPrint("\nNetwork out of sync %x!=%x! %d!=%d! Cycle %lu\n\n" _C_
syncSeed _C_ NetworkSyncSeeds[gameNetCycle & 0xFF] _C_ syncSeed _C_ NetworkSyncSeeds[gameNetCycle & 0xFF] _C_
syncHash _C_ NetworkSyncHashs[gameNetCycle & 0xFF] _C_ GameCycle); syncHash _C_ NetworkSyncHashs[gameNetCycle & 0xFF] _C_ GameCycle);
} else {
gameInSync = true;
} }
} }