Do not queue ignored commands
[uci2wb.git] / UCI2WB.c
index 1632b81..ad897f5 100644 (file)
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -453,7 +453,6 @@ GUI2Engine()
        fflush(toE); fflush(stdout);\r
        if(!ReadLine(stdin, line)) printf("# EOF\n"), sprintf(line, "quit -1\n");\r
        sscanf(line, "%s", command);\r
-       DPRINT("# %s searching=%d\n", command, searching);\r
        if(!strcmp(command, "usermove")) { difficult--; break; } // for efficiency during game play, moves, time & otim are tried first\r
        else if(!strcmp(command, "time"))   sscanf(line+4, "%d", &myTime),  myTime  = (10*myTime)/unit;\r
        else if(!strcmp(command, "otim"))   sscanf(line+4, "%d", &hisTime), hisTime = (10*hisTime)/unit;\r
@@ -468,6 +467,10 @@ GUI2Engine()
            suspended = 1 + (searching == 1); // remember if we were pondering, and stop search ignoring bestmove\r
            StopSearch(1);\r
        }\r
+       else if(!strcmp(command, "xboard")) ;\r
+       else if(!strcmp(command, "accepted")) ;\r
+       else if(!strcmp(command, "rejected")) ;\r
+       else if(!strcmp(command, "computer")) comp = 1;\r
        else { //convert easy & hard to "option" after treating their effect on the adapter\r
          if(!strcmp(command, "easy")) {\r
            if(*canPonder) ponder = 0, sprintf(command, "option"), sprintf(line, "option %s=0\n", canPonder); else continue;\r
@@ -509,6 +512,7 @@ GUI2Engine()
            suspended = 0;  *qEnd++ = '\n'; Sync(WAKEUP); // causes search to start in normal way if on move or analyzing\r
        } else\r
       {\r
+       DPRINT("# queue '%s', searching=%d\n", command, searching);\r
        if(searching == 3) { // command arrived during thinking; order abort for 'instant commands'\r
            if(!strcmp(command, "?") || !strcmp(command, "quit") ||\r
               !strcmp(command, "force") || !strcmp(command, "result")) StopSearch(0);\r
@@ -596,7 +600,6 @@ DoCommand ()
            inex = 1; line[strlen(line)-1] = sm = 0; // strip LF and clear sm flag\r
            for(i=1; i<nr; i++) { if(!strcmp(line+8, moveMap[i]) || all) on[i] = in; sm |= on[i]+1; } // sm: 2 = enabled, 1 = disabled\r
        }\r
-       else if(!strcmp(command, "xboard")) ;\r
        else if(!strcmp(command, "analyze"))computer = ANALYZE, collect = 1, sm = 0, Analyze("true");\r
        else if(!strcmp(command, "exit"))   computer = NONE, Analyze("false");\r
        else if(!strcmp(command, "force"))  computer = NONE;\r
@@ -612,7 +615,6 @@ DoCommand ()
        else if(!strcmp(command, "sd"))     sscanf(line, "sd %d", &depth);\r
        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")) {\r
            if(sc == 's') EPRINT((f, "# gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose"))\r
            computer = NONE;\r