From: H.G. Muller Date: Thu, 22 Sep 2011 15:17:16 +0000 (+0200) Subject: Fix LoadGameOrPosition starting up engine X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d28f72dd6b7797740863061eeabb0089b2c24b83;p=xboard.git Fix LoadGameOrPosition starting up engine When LoadGameOrPosition() is called from NextMatchGame(), the Reset() that is called in LoadPosition() when you are running from a position file would prematurely start up the engine (without waiting for features). The kludge to suppress this behavior for the explicit call to Reset() is now extended to encompass LoadGameOrPosition. --- diff --git a/backend.c b/backend.c index 43e50eb..1682703 100644 --- a/backend.c +++ b/backend.c @@ -10053,7 +10053,7 @@ NextTourneyGame(int nr, int *swapColors) void NextMatchGame() { // performs game initialization that does not invoke engines, and then tries to start the game - int firstWhite, swapColors = 0; + int res, firstWhite, swapColors = 0; if(!NextTourneyGame(nextGame, &swapColors)) return; // this sets matchGame, -fcp / -scp and other options for next game, if needed firstWhite = appData.firstPlaysBlack ^ (matchGame & 1 | appData.sameColorGames > 1); // non-incremental default firstWhite ^= swapColors; // reverses if NextTourneyGame says we are in an odd round @@ -10062,8 +10062,9 @@ NextMatchGame() appData.noChessProgram = (first.pr == NoProc); // kludge to prevent Reset from starting up chess program if(appData.loadGameIndex == -2) srandom(appData.seedBase + 68163*(nextGame & ~1)); // deterministic seed to force same opening Reset(FALSE, first.pr != NoProc); - appData.noChessProgram = FALSE; - if(!LoadGameOrPosition(matchGame)) return; // setup game; abort when bad game/pos file + res = LoadGameOrPosition(matchGame); // setup game + appData.noChessProgram = FALSE; // LoadGameOrPosition might call Reset too! + if(!res) return; // abort when bad game/pos file TwoMachinesEvent(); }