Continue search on ponder hit
[gnushogi.git] / gnushogi / search.c
index e87e1d4..ee7b402 100644 (file)
@@ -4,6 +4,7 @@
  * ----------------------------------------------------------------------
  * Copyright (c) 1993, 1994, 1995 Matthias Mutz
  * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
+ * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation
  *
  * GNU SHOGI is based on GNU CHESS
  *
@@ -43,6 +44,7 @@ short PVari;        /* Is this the PV */
 #endif
 
 short zwndw;
+short movesLeft, currentMove;
 
 
 
@@ -401,7 +403,7 @@ SelectMove(short side, SelectMove_mode iop)
     /********************** end of main loop ***************************/
 
     /* background mode */
-    if (iop == BACKGROUND_MODE)
+    if (background) /* originally: if (iop == BACKGROUND_MODE) */
         return;
 
     if (rpt >= 3)
@@ -861,7 +863,6 @@ search(short side,
         nxtline[ply + 1] = 0;
 
         /* if at top level */
-#if !defined NOPOST
         if (ply == 1)
         {
 /* at the top update search status */
@@ -872,8 +873,9 @@ search(short side,
 #endif /* QUIETBACKGROUND */
                     dsp->ShowCurrentMove(pnt, node->f, node->t);
             }
+            movesLeft = TrPnt[2] - pnt; /* to report with XBoard periodic updates */
+            currentMove = node->f << 8 | node->t;
         }
-#endif
 
         if (!(node->flags & exact))
         {