Fix XB crash on giving keyboard focus to non-text widget
[xboard.git] / moves.c
diff --git a/moves.c b/moves.c
index 65fd74e..463935d 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -5,7 +5,7 @@
  * Massachusetts.
  *
  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009 Free Software Foundation, Inc.
+ * 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
  *
  * Enhancements Copyright 2005 Alessandro Scotti
  *
@@ -1229,6 +1229,7 @@ void DisambiguateCallback(board, flags, kind, rf, ff, rt, ft, closure)
        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
     }
 }
 
@@ -1239,7 +1240,7 @@ void Disambiguate(board, flags, closure)
 {
     int illegal = 0; char c = closure->promoCharIn;
 
-    closure->count = 0;
+    closure->count = closure->captures = 0;
     closure->rf = closure->ff = closure->rt = closure->ft = 0;
     closure->kind = ImpossibleMove;
     if (appData.debugMode) {