X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;fp=UCI2WB.c;h=871527648fc5ef53504ce3ce2ddd25b424415feb;hp=b901bbcbcba92bb1b9b6ae82c0a0b2a487756ade;hb=42d1fe296f371b87c4e9520c71e534ffe5569c77;hpb=1788d5e3e95e8b959a382171f31da23cc10d5ee3 diff --git a/UCI2WB.c b/UCI2WB.c index b901bbc..8715276 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -160,9 +160,10 @@ StartSearch(char *ponder) } void -StopPonder(int pondering) +StopSearch(int discard) { - if(!pondering) return; + if(!searching) return; + if(discard) searching = 0; // this causes bestmove to be ignored EPRINT((f, "# stop\n")) fflush(toE); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove' } @@ -460,7 +461,7 @@ GUI2Engine() else if(!strcmp(command, "pause")) { if(computer == stm) myTime -= GetTickCount() - startTime; suspended = 1 + (searching == 1); // remember if we were pondering, and stop search ignoring bestmove - if(searching) searching = 0, StopPonder(1); + StopSearch(1); } else { //convert easy & hard to "option" after treating their effect on the adapter if(!strcmp(command, "easy")) { @@ -493,7 +494,7 @@ GUI2Engine() EPRINT((f, "# ponderhit%s\n", draw)) fflush(toE); fflush(stdout); continue; } - searching = 0; StopPonder(1); + StopSearch(1); } strcpy(move[moveNr++], command); // possibly overwrites ponder move *qEnd++ = '\n'; Sync(WAKEUP); // make sure engine thread considers starting a search @@ -505,8 +506,8 @@ GUI2Engine() { if(searching == 3) { // command arrived during thinking; order abort for 'instant commands' if(!strcmp(command, "?") || !strcmp(command, "quit") || - !strcmp(command, "force") || !strcmp(command, "result")) StopPonder(1); - } else if(searching) searching = 0, StopPonder(1); // always abort pondering or analysis + !strcmp(command, "force") || !strcmp(command, "result")) StopSearch(0); + } else StopSearch(1); // always abort pondering or analysis // queue command for execution by engine thread if(qStart == qEnd) qStart = qEnd = queue;