Fix illegal-drop fix
[xboard.git] / backend.c
index d8b85a1..e4e3550 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -5528,7 +5528,7 @@ ParseOneMove (char *move, int moveNum, ChessMove *moveType, int *fromX, int *fro
       /* End of code added by Tord */
       case IllegalMove:                /* bug or odd chess variant */
        if(currentMoveString[1] == '@') { // illegal drop
-         *fromX = *moveType == WhiteOnMove(moveNum) ?
+         *fromX = WhiteOnMove(moveNum) ?
            (int) CharToPiece(ToUpper(currentMoveString[0])) :
            (int) CharToPiece(ToLower(currentMoveString[0]));
          goto drop;
@@ -7556,7 +7556,7 @@ printf("to click %d,%d\n",x,y);
                else gatingPiece = doubleClick ? fromP : EmptySquare;
                fromX = x;
                fromY = y; dragging = 1;
-               ReportClick("lift", x, y);
+               if(!second) ReportClick("lift", x, y);
                MarkTargetSquares(0);
                DragPieceBegin(xPix, yPix, FALSE);
                if(appData.sweepSelect && CanPromote(piece = boards[currentMove][y][x], y)) {
@@ -7732,7 +7732,7 @@ printf("(%d,%d)-(%d,%d) %d %d\n",fromX,fromY,toX,toY,x,y);
 
     if(legal[toY][toX] == 2) promoChoice = ToLower(PieceToChar(defaultPromoChoice)); // highlight-induced promotion
 
-    if (legal[toY][toX] == 2 || HasPromotionChoice(fromX, fromY, toX, toY, &promoChoice, appData.sweepSelect)) {
+    if (legal[toY][toX] == 2 && !appData.sweepSelect || HasPromotionChoice(fromX, fromY, toX, toY, &promoChoice, appData.sweepSelect)) {
        SetHighlights(fromX, fromY, toX, toY);
         MarkTargetSquares(1);
        if(gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat || gameInfo.variant == VariantGrand) {