X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=8837d9750198522425ef72a0c80f647c42a25d03;hb=b9ca4bb374bb650af227573139c30630d85d47da;hp=242d064e1375a3a5f5e1bd8cd0bde37535617a5d;hpb=3b22355af3b7755e6ada823c0ab587b75b7ed551;p=xboard.git diff --git a/backend.c b/backend.c index 242d064..8837d97 100644 --- a/backend.c +++ b/backend.c @@ -10180,6 +10180,27 @@ SwapEngines (int n) } int +GetEngineLine (char *s, int n) +{ + int i; + char buf[MSG_SIZ]; + extern char *icsNames; + if(!s || !*s) return 0; + NamesToList(n == 10 ? icsNames : firstChessProgramNames, command, mnemonic, "all"); + for(i=1; mnemonic[i]; i++) if(!strcmp(s, mnemonic[i])) break; + if(!mnemonic[i]) return 0; + snprintf(buf, MSG_SIZ, "-%s %s", n == 10 ? "icshost" : "fcp", command[i]); + if(n == 1) SwapEngines(n); + ParseArgsFromString(buf); + if(n == 1) SwapEngines(n); + if(n == 0 && *appData.secondChessProgram == NULLCHAR) { + SwapEngines(1); // set second same as first if not yet set (to suppress WB startup dialog) + ParseArgsFromString(buf); + } + return 1; +} + +int SetPlayer (int player, char *p) { // [HGM] find the engine line of the partcipant given by number, and parse its options. int i;