From: H.G.Muller Date: Sun, 18 Dec 2022 13:24:01 +0000 (+0100) Subject: Allow out-of-turn switching to Machine mode X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=4c0f8b8257f57cedd5f50c1d4884129f1eff9927;p=xboard.git Allow out-of-turn switching to Machine mode It is now also possible to switch to Machine White or Machine Black when the side we switch the engine to is not on move. This is treated the same way as if the engine was suspended because of a book hit. --- diff --git a/backend.c b/backend.c index e6f6f18..5a9cea5 100644 --- a/backend.c +++ b/backend.c @@ -15239,12 +15239,12 @@ MachineWhiteEvent () if (gameMode == EditPosition) EditPositionDone(TRUE); - +/* if (!WhiteOnMove(currentMove)) { DisplayError(_("It is not White's turn"), 0); return; } - +*/ if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) ExitAnalyzeMode(); @@ -15260,6 +15260,14 @@ MachineWhiteEvent () gameMode = MachinePlaysWhite; pausing = FALSE; ModeHighlight(); + + if(!WhiteOnMove(currentMove)) { + first.bookSuspend = TRUE; + StartClocks(); + firstMove = FALSE; + return; + } + SetGameInfo(); snprintf(buf, MSG_SIZ, "%s %s %s", gameInfo.white, _("vs."), gameInfo.black); DisplayTitle(buf); @@ -15322,12 +15330,12 @@ MachineBlackEvent () if (gameMode == EditPosition) EditPositionDone(TRUE); - +/* if (WhiteOnMove(currentMove)) { DisplayError(_("It is not Black's turn"), 0); return; } - +*/ if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) ExitAnalyzeMode(); @@ -15339,6 +15347,14 @@ MachineBlackEvent () gameMode = MachinePlaysBlack; pausing = FALSE; ModeHighlight(); + + if(WhiteOnMove(currentMove)) { + first.bookSuspend = TRUE; + StartClocks(); + firstMove = FALSE; + return; + } + SetGameInfo(); snprintf(buf, MSG_SIZ, "%s %s %s", gameInfo.white, _("vs."), gameInfo.black); DisplayTitle(buf);