Move Engine2GUI to a more convenient place
[uci2wb.git] / UCI2WB.c
index d44de74..8de43f5 100644 (file)
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -411,13 +411,6 @@ HandleEngineOutput()
     }\r
 }\r
 \r
-void *\r
-Engine2GUI()\r
-{\r
-    if(fromF = fopen("DefectiveEngineOptions.ini", "r")) printf("# fake engine input\n");\r
-    HandleEngineOutput();\r
-}\r
-\r
 void\r
 Move4Engine(char *m)\r
 {\r
@@ -469,8 +462,6 @@ GUI2Engine()
     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
        if(!ReadLine(stdin, line)) printf("# EOF\n"), sprintf(line, "quit -1\n");\r
@@ -525,7 +516,7 @@ GUI2Engine()
                    searching = 0; pause = 2; moveNr++; startTime = GetTickCount(); // clock starts running now\r
                    EPRINT((f, "# ponderhit%s\n", draw)) fflush(toE); fflush(stdout);\r
                    searching = 3; // request blocking input during thinking\r
-                   goto nomove;\r
+                   continue;\r
                }\r
                StopPonder(1); searching = 0;\r
            }\r
@@ -544,8 +535,10 @@ GUI2Engine()
        }\r
        if(qStart == qEnd) qStart = qEnd = queue;\r
        p = line; while(qEnd < queue+10000 && (*qEnd++ = *p++) != '\n') {}\r
-       if(DoCommand()) goto nomove;\r
+       if(DoCommand()) continue;\r
       }\r
+\r
+       LaunchSearch(); // start a search if we need one\r
     }\r
 }\r
 \r
@@ -649,6 +642,13 @@ DoCommand ()
     return 0;\r
 }\r
 \r
+void *\r
+Engine2GUI()\r
+{\r
+    if(fromF = fopen("DefectiveEngineOptions.ini", "r")) printf("# fake engine input\n");\r
+    HandleEngineOutput();\r
+}\r
+\r
 int\r
 StartEngine(char *cmdLine, char *dir)\r
 {\r