From 4c0f8b8257f57cedd5f50c1d4884129f1eff9927 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 18 Dec 2022 14:24:01 +0100 Subject: [PATCH] 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. --- backend.c | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) 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); -- 1.7.0.4