From: H.G. Muller Date: Tue, 16 Feb 2010 18:36:18 +0000 (+0100) Subject: Bugfix smart capture X-Git-Tag: master-20100221~21 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=558d1df7e18bf07e0deb7b2baed0a0d421ed49ab Bugfix smart capture Disambiguate was changed to make sure that for ambiguous moves, a capture would always prevail in the closure, rather than the last move that happened to be generated. Before, double-clicking a piece would sometimes plsy a non-capture. --- diff --git a/moves.c b/moves.c index 463935d..af04d1e 100644 --- a/moves.c +++ b/moves.c @@ -1223,12 +1223,15 @@ void DisambiguateCallback(board, flags, kind, rf, ff, rt, ft, closure) (cl->ftIn == -1 || cl->ftIn == ft || wildCard)) { cl->count++; - cl->piece = board[rf][ff]; - cl->rf = rf; - cl->ff = ff; - cl->rt = wildCard ? cl->rtIn : rt; - cl->ft = wildCard ? cl->ftIn : ft; - cl->kind = kind; + if(cl->count == 1 || board[rt][ft] != EmptySquare) { + // [HGM] oneclick: if multiple moves, be sure we remember capture + cl->piece = board[rf][ff]; + cl->rf = rf; + cl->ff = ff; + cl->rt = wildCard ? cl->rtIn : rt; + cl->ft = wildCard ? cl->ftIn : ft; + cl->kind = kind; + } cl->captures += (board[cl->rt][cl->ft] != EmptySquare); // [HGM] oneclick: count captures } }