}\r
}\r
\r
-int DoCommand ();\r
+void DoCommand ();\r
char mySide;\r
volatile char queue[10000], *qStart, *qEnd;\r
\r
{\r
int i;\r
\r
- if((computer == stm || computer == ANALYZE && !searching) && !suspended) {\r
+ if((computer == stm || computer == ANALYZE && !searching && sm != 1) && !suspended) {\r
DPRINT("# start search\n");\r
LoadPos(moveNr); fflush(stdout); // load position\r
// and set engine thinking (note USI swaps colors!)\r
}\r
}\r
\r
-int\r
+void\r
DoCommand ()\r
{\r
char line[1024], command[256], *p, *q, *r, type[99];\r
int i;\r
\r
p=line; while(qStart < qEnd && (*p++ = *qStart++) != '\n') {} *p = 0;\r
- if(line[0] == '\n') return 0;\r
+ if(line[0] == '\n') return;\r
sscanf(line, "%s", command);\r
\r
if(!strcmp(command, "new")) {\r
int all = !strcmp(line+8, "all"), in = command[1] == 'n';\r
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
- if(!(sm & 2)) return 1; // no moves enabled; continue current search\r
}\r
else if(!strcmp(command, "xboard")) ;\r
else if(!strcmp(command, "analyze"))computer = ANALYZE, collect = 1, sm = 0, Analyze("true");\r
computer = NONE;\r
}\r
else if(!strcmp(command, "quit")) { EPRINT((f, "# quit\n")) fflush(toE), exit(atoi(line+4)); }\r
-\r
- return 0;\r
}\r
\r
void *\r
if(searching > 1) HandleEngineOutput(); // this could leave us (or fall through) pondering\r
while(qStart == qEnd && searching) HandleEngineOutput(); // relay ponder output until command arrives\r
Sync(PAUSE); // possibly wait for command silently if engine is idle\r
- if(!DoCommand()) LaunchSearch();\r
+ DoCommand(); LaunchSearch();\r
}\r
}\r
\r