From: H.G.Muller Date: Thu, 21 Apr 2016 20:47:18 +0000 (+0200) Subject: Fix confinement of Advisor in Xiangqi X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a757b3271db7ac0bfeb15fd68ea36b17be9e1e0a;p=xboard.git Fix confinement of Advisor in Xiangqi Ever since the move-generator rewrite the Advisor could leave the Palace! Now it can only move in XQ as a normal Ferz when on the board axis, and everywhere els it can only move to the axis one square from the edge. This does not generalize in a natural way to larger boards or larger Palaces. --- diff --git a/moves.c b/moves.c index cc3343b..a5ec955 100644 --- a/moves.c +++ b/moves.c @@ -1179,6 +1179,12 @@ GenPseudoLegal (Board board, int flags, MoveCallback callback, VOIDSTAR closure, case WhiteFerz: case BlackFerz: + if(gameInfo.variant == VariantXiangqi && ff != BOARD_WIDTH>>1) { + int rt = (piece == BlackFerz ? BOARD_HEIGHT-2 : 1); + int ft = BOARD_WIDTH>>1; + if(!SameColor(board[rf][ff], board[rt][ft])) + callback(board, flags, NormalMove, rf, ff, rt, ft, closure); + } else /* [HGM] support Shatranj pieces */ Ferz(board, flags, rf, ff, callback, closure); break;