From cfafc82a47f718181d7de520fd7616156a647656 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 2 Nov 2014 12:24:16 +0100 Subject: [PATCH] Also set e.p. rights on move of Lance The Lance is intended as Pawn alternative (because of its slim shape), except in Superchess (where it represents Amazon) and Chu. (In regular Shogi the Lace is represented by Queen disguised as Lance!) So it would be logical to also make its double-Pushes set e.p. rights. Except in Spartan Chess, which has no e.p. capture. --- backend.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backend.c b/backend.c index 2c7933e..3e432ae 100644 --- a/backend.c +++ b/backend.c @@ -9925,11 +9925,14 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) } } - if( board[fromY][fromX] == WhiteLance || board[fromY][fromX] == BlackLance ) { - if( gameInfo.variant != VariantSuper && gameInfo.variant != VariantShogi ) - board[EP_STATUS] = EP_PAWN_MOVE; // Lance is Pawn-like in most variants - } else - if( board[fromY][fromX] == WhitePawn ) { + piece = board[fromY][fromX]; + if( piece == WhiteLance || piece == BlackLance ) { + if( gameInfo.variant != VariantSuper && gameInfo.variant != VariantChu ) { + if(gameInfo.variant == VariantSpartan) board[EP_STATUS] = EP_PAWN_MOVE; // in Spartan no e.p. rights must be set + else piece += WhiteLance - WhitePawn; // Lance is Pawn-like in most variants, so let Pawn code treat it by this kludge + } + } + if( piece == WhitePawn ) { if(fromY != toY) // [HGM] Xiangqi sideway Pawn moves should not count as 50-move breakers board[EP_STATUS] = EP_PAWN_MOVE; if( toY-fromY>=2) { @@ -9942,7 +9945,7 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) board[EP_STATUS] = toX; } } else - if( board[fromY][fromX] == BlackPawn ) { + if( piece == BlackPawn ) { if(fromY != toY) // [HGM] Xiangqi sideway Pawn moves should not count as 50-move breakers board[EP_STATUS] = EP_PAWN_MOVE; if( toY-fromY<= -2) { -- 1.7.0.4