From a86dd9a7d5a89677bb2aca425b519e9829dff7b4 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 14 Feb 2013 13:02:08 +0100 Subject: [PATCH] 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. --- backend.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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 -- 1.7.0.4