From: H.G.Muller Date: Wed, 30 Nov 2016 13:17:55 +0000 (+0100) Subject: Also treat 'result' command immediately X-Git-Tag: v4.0~48 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=e4503efed01f5923d70288d6a7f50de29c27f0b7;hp=1e8b2a6e137452edec15c70394d22bf864a5d54f;p=uci2wb.git Also treat 'result' command immediately WinBoard has the nasty habit of sending a 'result' command just before 'quit' when it is closed while the engine is thinking, without putting the engine in force mode first. So this command has to abort thinking too. To prevent this will start a ponder search, 'result' now puts us in force mode. --- diff --git a/UCI2WB.c b/UCI2WB.c index 7d915e8..adfb3d6 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -428,7 +428,8 @@ GUI2Engine() sscanf(line, "%s", command); if(!strcmp(command, "offer")) { drawOffer = 1; goto nomove; } // backlogged anyway, so this can be done instantly if(think) { // command arrived during thinking; order abort for 'instant commands' - if(!strcmp(command, "quit") || !strcmp(command, "force") || !strcmp(command, "?")) { EPRINT((f, "# stop\n")); fflush(toE); } + if(!strcmp(command, "?") || !strcmp(command, "quit") || + !strcmp(command, "force") || !strcmp(command, "result")) { EPRINT((f, "# stop\n")); fflush(toE); } Sync(PAUSE); // block processing of input during thinking } if(!strcmp(command, "new")) { @@ -551,7 +552,10 @@ GUI2Engine() else if(!strcmp(command, "st")) sscanf(line, "st %d", &sTime), sTime = 1000*sTime - 30, inc = 0, sTime /= unit; else if(!strcmp(command, "name")) { if(namOpt) EPRINT((f, "# setoption name UCI_Opponent value none none %s %s", comp ? "computer" : "human", line+5)) } else if(!strcmp(command, "computer")) comp = 1; - else if(!strcmp(command, "result")) { if(sc == 's') EPRINT((f, "# gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose")) } + else if(!strcmp(command, "result")) { + if(sc == 's') EPRINT((f, "# gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose")) + computer = NONE; + } else if(!strcmp(command, "quit")) { EPRINT((f, "# quit\n")) fflush(toE), exit(atoi(line+4)); } } }