}
}
break;
+ case WhiteFalcon: // [HGM] wild: for wildcards, self-capture symbolizes move to anywhere
+ case BlackFalcon:
+ case WhiteCobra:
+ case BlackCobra:
+ case WhiteLance:
+ case BlackLance:
+ callback(board, flags, NormalMove, rf, ff, rf, ff, closure);
+ break;
}
}
if(piece == WhiteFalcon || piece == BlackFalcon ||
piece == WhiteCobra || piece == BlackCobra ||
piece == WhiteLance || piece == BlackLance)
- return NormalMove;
+ return CheckTest(board, flags, rf, ff, rt, ft, FALSE) ? IllegalMove : NormalMove;
cl.rf = rf;
cl.ff = ff;
VOIDSTAR closure;
{
register DisambiguateClosure *cl = (DisambiguateClosure *) closure;
+ int wildCard = FALSE; ChessSquare piece = board[rf][ff];
+
+ // [HGM] wild: for wild-card pieces rt and rf are dummies
+ if(piece == WhiteFalcon || piece == BlackFalcon ||
+ piece == WhiteCobra || piece == BlackCobra ||
+ piece == WhiteLance || piece == BlackLance)
+ wildCard = TRUE;
if ((cl->pieceIn == EmptySquare || cl->pieceIn == board[rf][ff]
|| PieceToChar(board[rf][ff]) == '~'
) &&
(cl->rfIn == -1 || cl->rfIn == rf) &&
(cl->ffIn == -1 || cl->ffIn == ff) &&
- (cl->rtIn == -1 || cl->rtIn == rt) &&
- (cl->ftIn == -1 || cl->ftIn == ft)) {
+ (cl->rtIn == -1 || cl->rtIn == rt || wildCard) &&
+ (cl->ftIn == -1 || cl->ftIn == ft || wildCard)) {
cl->count++;
cl->piece = board[rf][ff];
cl->rf = rf;
cl->ff = ff;
- cl->rt = rt;
- cl->ft = ft;
+ cl->rt = wildCard ? cl->rtIn : rt;
+ cl->ft = wildCard ? cl->ftIn : ft;
cl->kind = kind;
}
}
DisambiguateClosure *closure;
{
int illegal = 0; char c = closure->promoCharIn;
+
closure->count = 0;
closure->rf = closure->ff = closure->rt = closure->ft = 0;
closure->kind = ImpossibleMove;