From: H.G. Muller Date: Mon, 3 Dec 2012 11:58:36 +0000 (+0100) Subject: Fix Loop-Chess promotions X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=9e76d58957a505620e6c5395989ad4f9bbbffe93;p=xboard.git Fix Loop-Chess promotions Loop Chess is not a supported variant, but hould be playable as Crazyhouse with an altered pieceToCharTable, not defining the shadow promotion pieces. But with legality testing on promotion to shadow piece would take place even if the shadow piece was not defined. --- diff --git a/backend.c b/backend.c index 849259e..e9d10dc 100644 --- a/backend.c +++ b/backend.c @@ -9426,8 +9426,8 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) ) { /* white pawn promotion */ board[toY][toX] = CharToPiece(ToUpper(promoChar)); - if(gameInfo.variant==VariantBughouse || - gameInfo.variant==VariantCrazyhouse) /* [HGM] use shadow piece */ + if((gameInfo.variant==VariantBughouse || gameInfo.variant==VariantCrazyhouse) + && PieceToChar(PROMOTED board[toY][toX]) == '~') /* [HGM] use shadow piece (if available) */ board[toY][toX] = (ChessSquare) (PROMOTED board[toY][toX]); board[fromY][fromX] = EmptySquare; } else if ((fromY >= BOARD_HEIGHT>>1) @@ -9487,8 +9487,8 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) ) { /* black pawn promotion */ board[toY][toX] = CharToPiece(ToLower(promoChar)); - if(gameInfo.variant==VariantBughouse || - gameInfo.variant==VariantCrazyhouse) /* [HGM] use shadow piece */ + if((gameInfo.variant==VariantBughouse || gameInfo.variant==VariantCrazyhouse) + && PieceToChar(PROMOTED board[toY][toX]) == '~') /* [HGM] use shadow piece (if available) */ board[toY][toX] = (ChessSquare) (PROMOTED board[toY][toX]); board[fromY][fromX] = EmptySquare; } else if ((fromY < BOARD_HEIGHT>>1)