From dbc02c447b13a47e14bb9d4900ad38a311a25f20 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 8 May 2016 19:35:10 +0200 Subject: [PATCH] Fix forgetting 'choice' command after promotion The promotion restriction specified by a 'choice' command is now reset at the start of every new move, so that future promotion moves won't use it too. In addition,the 'choice' command is ignored when legality testing is on. --- backend.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index 79d04fb..6b206ea 100644 --- a/backend.c +++ b/backend.c @@ -7645,7 +7645,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) if(gameMode == AnalyzeMode && (pausing || controlKey) && first.excludeMoves) { // use pause state to exclude moves doubleClick = TRUE; gatingPiece = boards[currentMove][y][x]; } - fromX = x; fromY = y; toX = toY = killX = killY = kill2X = kill2Y = -1; + fromX = x; fromY = y; toX = toY = killX = killY = kill2X = kill2Y = -1; *promoRestrict = NULLCHAR; if(!appData.oneClick || !OnlyMove(&x, &y, FALSE) || // even if only move, we treat as normal when this would trigger a promotion popup, to allow sweep selection appData.sweepSelect && CanPromote(boards[currentMove][fromY][fromX], fromY) && originalY != y) { @@ -7697,7 +7697,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) !(fromP == BlackKing && toP == BlackRook && frc)))) { /* Clicked again on same color piece -- changed his mind */ second = (x == fromX && y == fromY); - killX = killY = kill2X = kill2Y = -1; + killX = killY = kill2X = kill2Y = -1; *promoRestrict = NULLCHAR; if(second && gameMode == AnalyzeMode && SubtractTimeMarks(&lastClickTime, &prevClickTime) < 200) { second = FALSE; // first double-click rather than scond click doubleClick = first.excludeMoves; // used by UserMoveEvent to recognize exclude moves @@ -9183,7 +9183,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h } return; } - if(sscanf(message, "choice %s", promoRestrict) == 1) { + if(!appData.testLegality && sscanf(message, "choice %s", promoRestrict) == 1) { if(deferChoice) { LeftClick(Press, 0, 0); // finish the click that was interrupted } else if(promoSweep != EmptySquare) { -- 1.7.0.4