X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=b248d0343a1cd62053c478beae828cf1b891d8e2;hb=c172f0cc52bcf9d4433149de82290c2941136180;hp=f9880463a9159b301f3d7656ffb2ee5b8677793b;hpb=94d2b2b896207fac048806e05c8a114297b1a513;p=xboard.git diff --git a/backend.c b/backend.c index f988046..b248d03 100644 --- a/backend.c +++ b/backend.c @@ -6986,7 +6986,7 @@ UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar) // holdings might not be sent yet in ICS play; we have to figure out which piece belongs here if(fromX == 0) fromY = BOARD_HEIGHT-1 - fromY; // black holdings upside-down fromX = fromX ? WhitePawn : BlackPawn; // first piece type in selected holdings - while(PieceToChar(fromX) == '.' || PieceToNumber(fromX) != fromY && fromX != (int) EmptySquare) fromX++; + while(PieceToChar(fromX) == '.' || PieceToChar(fromX) == '+' || PieceToNumber(fromX) != fromY && fromX != (int) EmptySquare) fromX++; fromY = DROP_RANK; } @@ -10149,8 +10149,8 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) p = (int) captured; if (p >= (int) BlackPawn) { p -= (int)BlackPawn; - if(gameInfo.variant == VariantShogi && DEMOTED p >= 0) { - /* in Shogi restore piece to its original first */ + if(DEMOTED p >= 0 && PieceToChar(p) == '+') { + /* Restore shogi-promoted piece to its original first */ captured = (ChessSquare) (DEMOTED captured); p = DEMOTED p; } @@ -10160,7 +10160,7 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) board[p][BOARD_WIDTH-1] = BLACK_TO_WHITE captured; } else { p -= (int)WhitePawn; - if(gameInfo.variant == VariantShogi && DEMOTED p >= 0) { + if(DEMOTED p >= 0 && PieceToChar(p) == '+') { captured = (ChessSquare) (DEMOTED captured); p = DEMOTED p; }