Fix Seirawan gating at Rook square in PGN castling moves
[xboard.git] / args.h
diff --git a/args.h b/args.h
index c518fad..3e376e5 100644 (file)
--- a/args.h
+++ b/args.h
@@ -112,6 +112,8 @@ char *firstEngineLine;
 char *secondEngineLine;
 char *icsNick;
 char *theme;
+char *replace;
+char *engineListFile;
 
 void EnsureOnScreen(int *x, int *y, int minX, int minY);
 char StringGet(void *getClosure);
@@ -517,6 +519,7 @@ ArgDescriptor argDescriptors[] = {
   { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames,
     !XBOARD, (ArgIniType) SCP_NAMES },
   { "themeNames", ArgString, (void *) &appData.themeNames, TRUE, (ArgIniType) "native -upf false -ub false -ubt false -pid \"\"\n" },
+  { "engineList", ArgFilename, (void *) &engineListFile, TRUE, (ArgIniType) "" },
   { "addMasterOption", ArgMaster, NULL, FALSE, INVALID },
   { "installEngine", ArgInstall, (void *) &firstChessProgramNames, FALSE, (ArgIniType) "" },
   { "installTheme", ArgInstall, (void *) &appData.themeNames, FALSE, (ArgIniType) "" },
@@ -617,8 +620,12 @@ ArgDescriptor argDescriptors[] = {
   { "epd", ArgTrue, (void *) &appData.epd, FALSE, INVALID },
   { "inscriptions", ArgString, (void *) &appData.inscriptions, FALSE, (ArgIniType) "" },
   { "autoInstall", ArgString, (void *) &appData.autoInstall, XBOARD, (ArgIniType) "" },
+  { "replace", ArgString, (void *) &replace, FALSE, (ArgIniType) NULL },
   { "fixedSize", ArgBoolean, (void *) &appData.fixedSize, TRUE, (ArgIniType) FALSE },
   { "showMoveTime", ArgBoolean, (void *) &appData.moveTime, TRUE, (ArgIniType) FALSE },
+  { "bmpSave", ArgInt, (void *) &appData.bmpSave, FALSE, 0 },
+  { "defaultEngineInstallDir", ArgFilename, (void *) &appData.defEngDir, FALSE, (ArgIniType) "." },
+  { "defaultInstallProtocol", ArgInt, (void *) &appData.defProtocol, TRUE, (ArgIniType) 0 },
 
   // [HGM] tournament options
   { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
@@ -1182,9 +1189,10 @@ ParseArgs(GetFunc get, void *cl)
         ASSIGN(*(char **) ad->argLoc, buf);
         break;
       }
-      if(!strncmp(argValue, "@@@@@", 5)) { // conditional string argument
-        if(*(char**) ad->argLoc == 0) { ASSIGN(*(char **) ad->argLoc, argValue+5); } // only used to replace empty string
-       break;
+      if(replace) { // previous -replace option makes this string option conditional
+       int differs = strcmp(*(char**) ad->argLoc, (char*) replace);
+       free(replace); replace = NULL; // but expires in the process
+        if(differs) break; // only use to replace the given string
       }
       ASSIGN(*(char **) ad->argLoc, argValue);
       break;
@@ -1432,6 +1440,14 @@ InitAppData(char *lpCmdLine)
   /* Parse command line */
   ParseArgs(StringGet, &lpCmdLine);
 
+  /* if separate engine list is used, parse that too */
+  if(*engineListFile) {
+    char buf[MSG_SIZ];
+    MySearchPath(installDir, engineListFile, buf);
+    if(*buf) { ASSIGN(engineListFile, buf); }
+    ParseSettingsFile(engineListFile, &engineListFile);
+  }
+
   if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
   if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions);
   chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);