From 8abb29a1624309afe03630a85c507854b862f131 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 30 Dec 2012 15:19:57 +0100 Subject: [PATCH] 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. --- backend.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) 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) -- 1.7.0.4