From: H.G. Muller Date: Sun, 30 Dec 2012 14:19:57 +0000 (+0100) Subject: Allow use of ~ in pieceToChar for shadow pieces in any variant X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=8abb29a1624309afe03630a85c507854b862f131;hp=9798d0e093e1ea35cbea11b5f0846d09d1e1ba34;p=xboard.git Allow use of ~ in pieceToChar for shadow pieces in any variant The use of shadow-pieces for promoted Pawns was limited to Crazyhouse and Bughouse. But this is not necessary, and in fact undesirable, as it made it impossible to implement Crazyhouse960, which combines shadow promotions with Fischer castling (only available in variant fischerandom)s, and thus has to be played as 8x8+5_fischerandom, using the Crazyhouse -pieceToChaTable. --- diff --git a/backend.c b/backend.c index 21ea333..57155b3 100644 --- a/backend.c +++ b/backend.c @@ -9453,8 +9453,7 @@ 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) - && PieceToChar(PROMOTED board[toY][toX]) == '~') /* [HGM] use shadow piece (if available) */ + if(board[toY][toX] < WhiteCannon && 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) @@ -9514,8 +9513,7 @@ 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) - && PieceToChar(PROMOTED board[toY][toX]) == '~') /* [HGM] use shadow piece (if available) */ + if(board[toY][toX] < BlackCannon && 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)