Provide user interface for promotion drops
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 22 Apr 2018 19:20:37 +0000 (21:20 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 22 Apr 2018 19:20:37 +0000 (21:20 +0200)
Pressing the Shift key during a drop move will attempt to drop the promoted
version of the piece.

backend.c

index 2394fb6..9fe24ae 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -7234,6 +7234,7 @@ UserMoveEvent (int fromX, int fromY, int toX, int toY, int promoChar)
           fromX = fromX ? WhitePawn : BlackPawn; // first piece type in selected holdings
           while(PieceToChar(fromX) == '.' || PieceToChar(fromX) == '+' || PieceToNumber(fromX) != fromY && fromX != (int) EmptySquare) fromX++;
          fromY = DROP_RANK;
+         if(autoProm[fromX] && shiftKey) fromX = CHUPROMOTED(fromX);
     }
 
     /* [HGM] always test for legality, to get promotion info */