Also treat 'result' command immediately
[uci2wb.git] / UCI2WB.c
index 7d915e8..adfb3d6 100644 (file)
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -428,7 +428,8 @@ GUI2Engine()
        sscanf(line, "%s", command);\r
        if(!strcmp(command, "offer")) { drawOffer = 1; goto nomove; } // backlogged anyway, so this can be done instantly\r
        if(think) {      // command arrived during thinking; order abort for 'instant commands'\r
-           if(!strcmp(command, "quit") || !strcmp(command, "force") || !strcmp(command, "?")) { EPRINT((f, "# stop\n")); fflush(toE); }\r
+           if(!strcmp(command, "?") || !strcmp(command, "quit") ||\r
+              !strcmp(command, "force") || !strcmp(command, "result")) { EPRINT((f, "# stop\n")); fflush(toE); }\r
            Sync(PAUSE); // block processing of input during thinking\r
        }\r
        if(!strcmp(command, "new")) {\r
@@ -551,7 +552,10 @@ GUI2Engine()
        else if(!strcmp(command, "st"))     sscanf(line, "st %d", &sTime), sTime = 1000*sTime - 30, inc = 0, sTime /= unit;\r
        else if(!strcmp(command, "name"))   { if(namOpt) EPRINT((f, "# setoption name UCI_Opponent value none none %s %s", comp ? "computer" : "human", line+5)) }\r
        else if(!strcmp(command, "computer")) comp = 1;\r
-       else if(!strcmp(command, "result")) { if(sc == 's') EPRINT((f, "# gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose")) }\r
+       else if(!strcmp(command, "result")) {\r
+           if(sc == 's') EPRINT((f, "# gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose"))\r
+           computer = NONE;\r
+       }\r
        else if(!strcmp(command, "quit"))   { EPRINT((f, "# quit\n")) fflush(toE), exit(atoi(line+4)); }\r
     }\r
 }\r