From 187d2084a787e3014e88bf66a96018108a936774 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Wed, 6 Dec 2006 23:31:21 +0000 Subject: [PATCH] Do not hang when there's a reset during the game due to sync loss. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2574 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/battle.c | 4 +++- sc2/src/sc2code/netplay/netmelee.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sc2/src/sc2code/battle.c b/sc2/src/sc2code/battle.c index 1a324585b..40b8be7a7 100644 --- a/sc2/src/sc2code/battle.c +++ b/sc2/src/sc2code/battle.c @@ -285,10 +285,12 @@ DoBattle (BATTLE_STATE *bs) && (battleFrameCount - delay) % NETPLAY_CHECKSUM_INTERVAL == 0) { if (!(GLOBAL (CurrentActivity) & CHECK_ABORT)) + { if (!verifyChecksums (battleFrameCount - delay)) { GLOBAL(CurrentActivity) |= CHECK_ABORT; - resetConnections(ResetReason_syncLoss); + resetConnections (ResetReason_syncLoss); } + } } } #endif diff --git a/sc2/src/sc2code/netplay/netmelee.c b/sc2/src/sc2code/netplay/netmelee.c index 50405d707..c94a1d649 100644 --- a/sc2/src/sc2code/netplay/netmelee.c +++ b/sc2/src/sc2code/netplay/netmelee.c @@ -267,7 +267,7 @@ networkBattleInput(COUNT player, STARSHIPPTR StarShipPtr) { for (;;) { bool ok; - + #if 0 // This is a useful debugging trick. By enabling this #if // block, this side will always lag the maximum number of frames @@ -300,6 +300,9 @@ networkBattleInput(COUNT player, STARSHIPPTR StarShipPtr) { GLOBAL(CurrentActivity) |= CHECK_ABORT; return (BATTLE_INPUT_STATE) 0; } + + if (GLOBAL(CurrentActivity) & CHECK_ABORT) + return (BATTLE_INPUT_STATE) 0; #if 0 log_add(log_Warning, "NETPLAY: [%d] stalling for "