Fix click-click sweep promotions to empty square
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 12 Apr 2012 22:33:28 +0000 (00:33 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 12 Apr 2012 22:33:28 +0000 (00:33 +0200)
These did not work, because DragPieceBegin would fail on an EmptySquare.

backend.c

index bd2a2c7..a2ff648 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -7190,7 +7190,10 @@ LeftClick (ClickType clickType, int xPix, int yPix)
        if(HasPromotionChoice(fromX, fromY, toX, toY, &promoChoice, FALSE)) {
          if(appData.sweepSelect) {
            ChessSquare piece = boards[currentMove][fromY][fromX];
+           ChessSquare victim = boards[currentMove][toY][toX];
+           boards[currentMove][toY][toX] = piece; // kludge: make sure there is something to grab for drag
            DragPieceBegin(xPix, yPix, TRUE); dragging = 1;
+           boards[currentMove][toY][toX] = victim;
            promoSweep = defaultPromoChoice;
            if(PieceToChar(PROMOTED piece) == '+') promoSweep = PROMOTED piece;
            selectFlag = 0; lastX = xPix; lastY = yPix;