Some code refactoring and cleanup; one small bug fix
[xboard.git] / winboard / wengineo.c
index d10f3d9..4876a70 100644 (file)
@@ -3,6 +3,8 @@
  *\r
  * Author: Alessandro Scotti (Dec 2005)\r
  *\r
+ * Copyright 2005 Alessandro Scotti\r
+ *\r
  * ------------------------------------------------------------------------\r
  *\r
  * GNU XBoard is free software: you can redistribute it and/or modify\r
@@ -32,9 +34,9 @@
 #include <dlgs.h>\r
 \r
 #include "common.h"\r
-#include "winboard.h"\r
 #include "frontend.h"\r
 #include "backend.h"\r
+#include "winboard.h"\r
 \r
 #include "wsnap.h"\r
 \r
@@ -59,27 +61,8 @@ HICON icons[8]; // [HGM] this front-end array translates back-end icon indicator
 \r
 HWND outputField[2][7]; // [HGM] front-end array to translate output field to window handle\r
 \r
-void EngineOutputPopUp();\r
-void EngineOutputPopDown();\r
-int  EngineOutputIsUp();\r
-\r
 #define SHOW_PONDERING\r
 \r
-/* Imports from backend.c */\r
-char * SavePart(char *str);\r
-extern int opponentKibitzes;\r
-\r
-/* Imports from winboard.c */\r
-extern HWND engineOutputDialog;\r
-extern int     engineOutputDialogUp;\r
-\r
-extern HINSTANCE hInst;\r
-extern HWND hwndMain;\r
-\r
-extern WindowPlacement wpEngineOutput;\r
-\r
-extern BoardSize boardSize;\r
-\r
 /* Module variables */\r
 #define H_MARGIN            2\r
 #define V_MARGIN            2\r
@@ -95,12 +78,11 @@ extern BoardSize boardSize;
 #define STATE_ANALYZING  3\r
 \r
 static int  windowMode = 1;\r
-\r
 static int  needInit = TRUE;\r
-\r
 static int  lastDepth[2] = { -1, -1 };\r
 static int  lastForwardMostMove[2] = { -1, -1 };\r
 static int  engineState[2] = { -1, -1 };\r
+static BOOLEAN engineOutputDialogUp = FALSE;\r
 \r
 typedef struct {\r
 //    HWND hColorIcon; // [HGM] the output-control handles are no loger passed,\r
@@ -545,7 +527,7 @@ void EngineOutputUpdate( FrontEndProgramStats * stats )
     if( clearMemo ) DoClearMemo(which);\r
 \r
     /* Update */\r
-    lastDepth[which] = depth;\r
+    lastDepth[which] = depth == 1 && ed.nodes == 0 ? 0 : depth; // [HGM] info-line kudge\r
     lastForwardMostMove[which] = forwardMostMove;\r
 \r
     if( ed.pv != 0 && ed.pv[0] == ' ' ) {\r
@@ -805,7 +787,8 @@ static void UpdateControls( EngineOutputData * ed )
         sprintf( s_time, "%d:%02d.%02d", time_secs / 60, time_secs % 60, time_cent );\r
 \r
         /* Put all together... */\r
-        sprintf( buf, "%3d\t%s\t%s\t%s\t", ed->depth, s_score, s_nodes, s_time );\r
+       if(ed->nodes == 0 && ed->score == 0 && ed->time == 0) sprintf( buf, "%3d\t", ed->depth ); else \r
+       sprintf( buf, "%3d\t%s\t%s\t%s\t", ed->depth, s_score, s_nodes, s_time );\r
 \r
         /* Add PV */\r
         buflen = strlen(buf);\r