From: H.G. Muller Date: Sat, 10 Oct 2009 15:27:55 +0000 (-0700) Subject: fix for bug #27642: Clock jumps strangely in engine mode X-Git-Tag: v4.4.1.20091019~43 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=de954fa0f31cc935b5ad61819a04de2713cd98ed fix for bug #27642: Clock jumps strangely in engine mode This moves SwitchClocks() back to after incrementing forwardMostMove, so that it knows again who has the move (which was broken by the "bare" patch), and will take the appropriate tick length. --- diff --git a/backend.c b/backend.c index 565942b..3605468 100644 --- a/backend.c +++ b/backend.c @@ -5050,7 +5050,6 @@ int lastLoadGameUseList = FALSE; char lastLoadGameTitle[MSG_SIZ], lastLoadPositionTitle[MSG_SIZ]; ChessMove lastLoadGameStart = (ChessMove) 0; - ChessMove UserMoveTest(fromX, fromY, toX, toY, promoChar, captureOwn) int fromX, fromY, toX, toY; @@ -7475,9 +7474,6 @@ MakeMove(fromX, fromY, toX, toY, promoChar) 0, 1); return; } - SwitchClocks(); - timeRemaining[0][forwardMostMove+1] = whiteTimeRemaining; - timeRemaining[1][forwardMostMove+1] = blackTimeRemaining; if (commentList[forwardMostMove+1] != NULL) { free(commentList[forwardMostMove+1]); commentList[forwardMostMove+1] = NULL; @@ -7487,6 +7483,9 @@ MakeMove(fromX, fromY, toX, toY, promoChar) ApplyMove(fromX, fromY, toX, toY, promoChar, boards[forwardMostMove+1], castlingRights[forwardMostMove+1], &epStatus[forwardMostMove+1]); forwardMostMove++; // [HGM] bare: moved to after ApplyMove, to make sure clock interrupt finds complete board + SwitchClocks(); // uses forwardMostMove, so must be done after incrementing it ! + timeRemaining[0][forwardMostMove] = whiteTimeRemaining; + timeRemaining[1][forwardMostMove] = blackTimeRemaining; gameInfo.result = GameUnfinished; if (gameInfo.resultDetails != NULL) { free(gameInfo.resultDetails);