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;
if(rFilter >= 0 && rFilter != rt || fFilter >= 0 && fFilter != ft) return; // [HGM] speed: ignore moves with wrong to-square
- if (board[EP_STATUS] == EP_IRON_LION && (board[rt][ft] == WhiteLion || board[rt][ft] == BlackLion)) return; //[HGM] lion
+ if ((int)board[EP_STATUS] == EP_IRON_LION && (board[rt][ft] == WhiteLion || board[rt][ft] == BlackLion)) return; //[HGM] lion
if (!(flags & F_IGNORE_CHECK) ) {
int check, promo = (gameInfo.variant == VariantSpartan && kind == BlackPromotion);
register CheckTestClosure *cl = (CheckTestClosure *) closure;
if (rt == cl->rking && ft == cl->fking) {
- if(xqCheckers[EP_STATUS] >= 2 && xqCheckers[rf][ff]) return; // checker is piece with suspended checking power
+ if((int)xqCheckers[EP_STATUS] >= 2 && xqCheckers[rf][ff]) return; // checker is piece with suspended checking power
cl->check++;
xqCheckers[rf][ff] = xqCheckers[EP_STATUS] & 1; // remember who is checking (if status == 1)
}
- if( board[EP_STATUS] == EP_ROYAL_LION && (board[rt][ft] == WhiteLion || board[rt][ft] == BlackLion)
+ if( (int)board[EP_STATUS] == EP_ROYAL_LION && (board[rt][ft] == WhiteLion || board[rt][ft] == BlackLion)
&& (gameInfo.variant != VariantLion || board[rf][ff] != WhiteKing && board[rf][ff] != BlackKing) )
cl->check++; // [HGM] lion: forbidden counterstrike against Lion equated to putting yourself in check
}
// [HGM] wild: for wild-card pieces rt and rf are dummies
if(piece == WhiteFalcon || piece == BlackFalcon ||
piece == WhiteCobra || piece == BlackCobra)
- wildCard = TRUE;
+ wildCard = !pieceDefs; // no wildcards when engine defined pieces
if ((cl->pieceIn == EmptySquare || cl->pieceIn == board[rf][ff]
|| PieceToChar(board[rf][ff]) == '~'
return;
}
}
- } else if(pieceDefs && closure->count > 1) { // [HGM] gen: move is ambiguous under engine-defined rules
+ } else if(pieceDefs && closure->count > 1 && closure->rtIn >=0) { // [HGM] gen: move is ambiguous under engine-defined rules (and not one-click)
DisambiguateClosure spare = *closure;
pieceDefs = FALSE; spare.count = 0; // See if the (erroneous) built-in rules would resolve that
GenLegal(board, flags, DisambiguateCallback, (VOIDSTAR) &spare, closure->pieceIn);