Fix deferral on sweep promotions
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 4 May 2016 13:18:34 +0000 (15:18 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 8 May 2016 12:06:34 +0000 (14:06 +0200)
When a sweep in the to-square due to a highlight-induced promotion
had left the original piece as choice, the piece would be considered
to promote to itself (i.e. the move would get the promoChar for its
piece type), rather than to not promote at all. Some engines choked
on this (HaChu). Now such a move is not considered a promotion.

backend.c

index b7aafee..0c12671 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -7898,7 +7898,10 @@ LeftClick (ClickType clickType, int xPix, int yPix)
 
     if(gatingPiece != EmptySquare && gameInfo.variant == VariantSChess) promoChoice = ToLower(PieceToChar(gatingPiece));
 
-    if(legal[toY][toX] == 2) promoChoice = ToLower(PieceToChar(defaultPromoChoice)); // highlight-induced promotion
+    if(legal[toY][toX] == 2) { // highlight-induced promotion
+       if(piece == defaultPromoChoice) promoChoice = NULLCHAR; // deferral
+       else promoChoice = ToLower(PieceToChar(defaultPromoChoice));
+    }
 
     if (legal[toY][toX] == 2 && !appData.sweepSelect || HasPromotionChoice(fromX, fromY, toX, toY, &promoChoice, appData.sweepSelect)) {
        SetHighlights(fromX, fromY, toX, toY);