void
AddToEngineList (int i)
{
+ if(addToList) {
int len;
char quote, buf[MSG_SIZ];
char *q = firstChessProgramNames, *p = newEngineCommand;
SaveEngineList();
FloatToFront(&appData.recentEngineList, buf);
ASSIGN(currentEngine[i], buf);
+ }
}
void
int i;
if(WaitForEngine(savCps, LoadEngine)) return;
if(tryNr == 1 && !isUCI) { SendToProgram("uci\n", savCps); tryNr = 2; ScheduleDelayedEvent(LoadEngine, FEATURE_TIMEOUT); return; }
- if(tryNr) v1 = (tryNr == 2), tryNr = 0, AddToEngineList(0); // deferred to after protocol determination
+ if(tryNr) v1 |= (tryNr == 2), tryNr = 0, AddToEngineList(0); // deferred to after protocol determination
CommonEngineInit(); // recalculate time odds
if(gameInfo.variant != StringToVariant(appData.variant)) {
// we changed variant when loading the engine; this forces us to reset
appData.clockMode = TRUE;
InitEngine(cps, n);
UpdateLogos(TRUE);
- if(n) return; // only startup first engine immediately; second can wait
+ if(n && !tryNr) return; // only startup first engine immediately; second can wait (unless autodetect)
savCps = cps; // parameter to LoadEngine passed as globals, to allow scheduled calling :-(
LoadEngine();
}
}
if(jar) { snprintf(buf3, MSG_SIZ, "java -jar %s", p); p = buf3; }
ASSIGN(appData.chessProgram[i], p);
+ tryNr = 3; // requests adding to list without auto-detect
+ if(isUCI == 3) tryNr = 1, isUCI = 0; // auto-detect
appData.isUCI[i] = isUCI;
appData.protocolVersion[i] = v1 ? 1 : PROTOVER;
appData.hasOwnBookUCI[i] = hasBook;
if(!nickName[0]) useNick = FALSE;
if(useNick) ASSIGN(appData.pgnName[i], nickName);
safeStrCpy(newEngineCommand, p, MSG_SIZ);
- tryNr = 1;
ReplaceEngine(cps, i);
}
GameEnds(cps->twoMachinesColor[0] == 'w' ? BlackWins : WhiteWins,
buf1, GE_XBOARD);
return;
- } else if(!appData.fischerCastling)
+ } else if(!appData.fischerCastling && toX != BOARD_WIDTH>>1)
/* [HGM] Kludge to handle engines that send FRC-style castling
when they shouldn't (like TSCP-Gothic) */
switch(moveType) {
cps->useSigterm = FALSE;
}
if (strncmp(message, "feature ", 8) == 0) { // [HGM] moved forward to pre-empt non-compliant commands
- ParseFeatures(message+8, cps); if(tryNr < 3) tryNr = 3;
+ ParseFeatures(message+8, cps); if(tryNr && tryNr < 3) tryNr = 3;
return; // [HGM] This return was missing, causing option features to be recognized as non-compliant commands!
}
return;
}
if(strncmp(message, "uciok", 5) == 0) { // response to "uci" probe
- appData.isUCI[0] = isUCI = 1;
- ReplaceEngine(&first, 0); // retry install as UCI
+ int nr = (cps == &second);
+ appData.isUCI[nr] = isUCI = 1;
+ ReplaceEngine(cps, nr); // retry install as UCI
return;
}
/*