From b42dab5e4509f49d27d78747e16a151962a237e2 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sat, 8 Dec 2018 10:02:49 +0100 Subject: [PATCH] Put launching of searches in a separate routine The code section that tested if the engine should search, and would start the required search if this was the case, is now put in a routine LaunchSearch(). This is then called from the infinite loop that handles the GUI commands (where it was located before). --- UCI2WB.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index 1fc24fc..c068847 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -441,12 +441,9 @@ char mySide; char queue[10000], *qStart, *qEnd; void -GUI2Engine() +LaunchSearch() { - char line[256], command[256], *p; - - while(1) { - int i, difficult; + int i; if((computer == stm || computer == ANALYZE && !searching) && !suspended) { DPRINT("# start search\n"); @@ -462,6 +459,17 @@ GUI2Engine() EPRINT((f, "\n")) searching = 2; // suppresses spurious commands during analysis starting new searches } else pause = 2, searching = 3, StartSearch(""); // request suspending of input processing while thinking } else if(ponderAlways && computer == NONE) move[moveNr][0] = 0, StartPonder(moveNr-1); +} + +void +GUI2Engine() +{ + char line[256], command[256], *p; + + while(1) { + int i, difficult; + + LaunchSearch(); // start a search if we need one nomove: for(difficult=0; !difficult; ) { // read and handle commands that can (or must) be handled during thinking fflush(toE); fflush(stdout); -- 1.7.0.4