Put launching of searches in a separate routine
[uci2wb.git] / UCI2WB.c
index 1fc24fc..c068847 100644 (file)
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -441,12 +441,9 @@ char mySide;
 char queue[10000], *qStart, *qEnd;\r
 \r
 void\r
-GUI2Engine()\r
+LaunchSearch()\r
 {\r
-    char line[256], command[256], *p;\r
-\r
-    while(1) {\r
-       int i, difficult;\r
+    int i;\r
 \r
        if((computer == stm || computer == ANALYZE && !searching) && !suspended) {\r
            DPRINT("# start search\n");\r
@@ -462,6 +459,17 @@ GUI2Engine()
                EPRINT((f, "\n")) searching = 2; // suppresses spurious commands during analysis starting new searches\r
            } else pause = 2, searching = 3, StartSearch(""); // request suspending of input processing while thinking\r
        } else if(ponderAlways && computer == NONE) move[moveNr][0] = 0, StartPonder(moveNr-1);\r
+}\r
+\r
+void\r
+GUI2Engine()\r
+{\r
+    char line[256], command[256], *p;\r
+\r
+    while(1) {\r
+       int i, difficult;\r
+\r
+       LaunchSearch(); // start a search if we need one\r
       nomove:\r
        for(difficult=0; !difficult; ) { // read and handle commands that can (or must) be handled during thinking\r
        fflush(toE); fflush(stdout);\r