From 9e76d58957a505620e6c5395989ad4f9bbbffe93 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 3 Dec 2012 12:58:36 +0100 Subject: [PATCH] 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. --- backend.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) 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) -- 1.7.0.4