X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=9a9d0a44e7758b7878dbeb3e73a69429c840b9f5;hb=dcd563701f4164a6f8b2e8e8c84ddb96601e147c;hp=f969aba5814a6b674c30e3651233ea42621b79e1;hpb=624048ee61b5b5de2934df02474e6b25b0b931e0;p=xboard.git diff --git a/backend.c b/backend.c index f969aba..9a9d0a4 100644 --- a/backend.c +++ b/backend.c @@ -5494,6 +5494,7 @@ char yy_textstr[8000]; Boolean ParseOneMove (char *move, int moveNum, ChessMove *moveType, int *fromX, int *fromY, int *toX, int *toY, char *promoChar) { + int badFrom; *moveType = yylexstr(moveNum, move, yy_textstr, sizeof yy_textstr); switch (*moveType) { @@ -5525,7 +5526,9 @@ ParseOneMove (char *move, int moveNum, ChessMove *moveType, int *fromX, int *fro *toX = currentMoveString[2] - AAA; *toY = currentMoveString[3] - ONE; *promoChar = currentMoveString[4]; - if (*fromX < BOARD_LEFT || *fromX >= BOARD_RGHT || *fromY < 0 || *fromY >= BOARD_HEIGHT || + badFrom = (*fromX < BOARD_LEFT || *fromX >= BOARD_RGHT || *fromY < 0 || *fromY >= BOARD_HEIGHT); + if(currentMoveString[1] == '@') { badFrom = FALSE; *fromX = CharToPiece(currentMoveString[0]); *fromY = DROP_RANK; } // illegal drop + if (badFrom || *toX < BOARD_LEFT || *toX >= BOARD_RGHT || *toY < 0 || *toY >= BOARD_HEIGHT) { if (appData.debugMode) { fprintf(debugFP, "Off-board move (%d,%d)-(%d,%d)%c, type = %d\n", *fromX, *fromY, *toX, *toY, *promoChar, *moveType); @@ -7495,7 +7498,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) return; } } - +printf("to click %d,%d\n",x,y); /* fromX != -1 */ if (clickType == Press && gameMode != EditPosition) { ChessSquare fromP; @@ -7558,6 +7561,12 @@ LeftClick (ClickType clickType, int xPix, int yPix) // ignore clicks on holdings if(x < BOARD_LEFT || x >= BOARD_RGHT) return; } +printf("A type=%d\n",clickType); + + if(x == fromX && y == fromY && gameMode == EditPosition && SubtractTimeMarks(&lastClickTime, &prevClickTime) < 200) { + gatingPiece = boards[currentMove][fromY][fromX]; // prepare to copy rather than move + return; + } if (clickType == Release && x == fromX && y == fromY && killX < 0) { DragPieceEnd(xPix, yPix); dragging = 0; @@ -7591,7 +7600,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) } clearFlag = 0; - +printf("B\n"); if(gameMode != EditPosition && !appData.testLegality && !legal[y][x] && fromX >= BOARD_LEFT && fromX < BOARD_RGHT && (x != killX || y != killY) && !sweepSelecting) { if(dragging) DragPieceEnd(xPix, yPix), dragging = 0; @@ -7599,7 +7608,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) DrawPosition(TRUE, NULL); return; // ignore to-click } - +printf("(%d,%d)-(%d,%d) %d %d\n",fromX,fromY,toX,toY,x,y); /* we now have a different from- and (possibly off-board) to-square */ /* Completed move */ if(!sweepSelecting) {