X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=8aae7b4489b4df79a5803758ff78b0755c65ccad;hb=3536ccf4ea73a0157ef01ae42c72e5448543eb39;hp=71a795c05a7cbf6b323b33650dfb09048ce6a3ac;hpb=f9f3643ce3447c431ee266ff241cad393872d416;p=xboard.git diff --git a/backend.c b/backend.c index 71a795c..8aae7b4 100644 --- a/backend.c +++ b/backend.c @@ -5527,7 +5527,12 @@ ParseOneMove (char *move, int moveNum, ChessMove *moveType, int *fromX, int *fro case BlackASideCastleFR: /* End of code added by Tord */ case IllegalMove: /* bug or odd chess variant */ - if(currentMoveString[1] == '@') goto drop; // illegal drop + if(currentMoveString[1] == '@') { // illegal drop + *fromX = WhiteOnMove(moveNum) ? + (int) CharToPiece(ToUpper(currentMoveString[0])) : + (int) CharToPiece(ToLower(currentMoveString[0])); + goto drop; + } *fromX = currentMoveString[0] - AAA; *fromY = currentMoveString[1] - ONE; *toX = currentMoveString[2] - AAA; @@ -5551,10 +5556,10 @@ ParseOneMove (char *move, int moveNum, ChessMove *moveType, int *fromX, int *fro case WhiteDrop: case BlackDrop: - drop: *fromX = *moveType == WhiteDrop ? (int) CharToPiece(ToUpper(currentMoveString[0])) : (int) CharToPiece(ToLower(currentMoveString[0])); + drop: *fromY = DROP_RANK; *toX = currentMoveString[2] - AAA; *toY = currentMoveString[3] - ONE; @@ -6561,7 +6566,7 @@ HasPromotionChoice (int fromX, int fromY, int toX, int toY, char *promoChoice, i promotionZoneSize = BOARD_HEIGHT/3; highestPromotingPiece = (p >= WhiteLion || PieceToChar(piece + 22) == '.') ? WhitePawn : WhiteLion; } else if(gameInfo.variant == VariantShogi) { - promotionZoneSize = BOARD_HEIGHT/3; + promotionZoneSize = BOARD_HEIGHT/3 +(BOARD_HEIGHT == 8); highestPromotingPiece = (int)WhiteAlfil; } else if(gameInfo.variant == VariantMakruk || gameInfo.variant == VariantGrand || gameInfo.variant == VariantChuChess) { promotionZoneSize = 3; @@ -7551,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)) { @@ -7727,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) { @@ -12070,8 +12075,13 @@ LoadGameOneMove (ChessMove readAhead) if (appData.debugMode) fprintf(debugFP, "Parsed %s into IllegalMove %s\n", yy_text, currentMoveString); - fromX = currentMoveString[0] - AAA; - fromY = currentMoveString[1] - ONE; + if(currentMoveString[1] == '@') { + fromX = CharToPiece(WhiteOnMove(currentMove) ? ToUpper(currentMoveString[0]) : ToLower(currentMoveString[0])); + fromY = DROP_RANK; + } else { + fromX = currentMoveString[0] - AAA; + fromY = currentMoveString[1] - ONE; + } toX = currentMoveString[2] - AAA; toY = currentMoveString[3] - ONE; promoChar = currentMoveString[4];