From: H.G. Muller Date: Thu, 14 Feb 2013 12:02:08 +0000 (+0100) Subject: Only perform e.p. capture if there are rights X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a86dd9a7d5a89677bb2aca425b519e9829dff7b4;p=xboard.git Only perform e.p. capture if there are rights The heuristic for e.p. capture was such that any non-forward move with a Pawn to an empty square would delete the piece behind its new location (Xiangqi exempted). This is now limited to cases where EP_STATUS indicates that the deleted piece was a Pawn that performed a double-push on the previous move. (Or if there is unknown EP_STATUS.) This makes XBoard more generally suitable for use with variants that have non-conventional Pawn moves (with legality testing off). To guarantee this will not have any unexpected effects in normal Chess, this patch will only be active if legality testing is off. --- diff --git a/backend.c b/backend.c index ea569f3..f61c15c 100644 --- a/backend.c +++ b/backend.c @@ -9480,6 +9480,7 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) board[toY][toX] = (ChessSquare) (PROMOTED board[toY][toX]); board[fromY][fromX] = EmptySquare; } else if ((fromY >= BOARD_HEIGHT>>1) + && (oldEP == toX || oldEP == EP_UNKNOWN || appData.testLegality) && (toX != fromX) && gameInfo.variant != VariantXiangqi && gameInfo.variant != VariantBerolina @@ -9540,6 +9541,7 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) board[toY][toX] = (ChessSquare) (PROMOTED board[toY][toX]); board[fromY][fromX] = EmptySquare; } else if ((fromY < BOARD_HEIGHT>>1) + && (oldEP == toX || oldEP == EP_UNKNOWN || appData.testLegality) && (toX != fromX) && gameInfo.variant != VariantXiangqi && gameInfo.variant != VariantBerolina