From 558d1df7e18bf07e0deb7b2baed0a0d421ed49ab Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 16 Feb 2010 19:36:18 +0100 Subject: [PATCH] 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. --- moves.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) 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 } } -- 1.7.0.4