Add option -defaultInstallProtocol
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 2 Nov 2017 11:43:23 +0000 (12:43 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 2 Nov 2017 11:47:22 +0000 (12:47 +0100)
A persistent option is added to determine the initial setting of the
protocol-selector combobox in the Load Engine dialog. It must be given
a value 0-4 corresponding to the choice order. This is mainly intended
for configuring Shogi or Xiangqi packages, to select USI or USI (for which
auto-detection does not work).

args.h
common.h
dialogs.c

diff --git a/args.h b/args.h
index db6ec8f..3e376e5 100644 (file)
--- a/args.h
+++ b/args.h
@@ -625,6 +625,7 @@ ArgDescriptor argDescriptors[] = {
   { "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) "" },
index 09ce693..55daf29 100644 (file)
--- a/common.h
+++ b/common.h
@@ -802,6 +802,7 @@ typedef struct {
     Boolean scoreWhite;
     Boolean pvSAN[ENGINES];
 
+    int defProtocol;
     int recentEngines;
     char *recentEngineList;
     char *defEngDir;
index 38b1d08..c1d0930 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -1568,7 +1568,9 @@ EngSel (int n, int sel)
 static void
 LoadEngineProc (int engineNr, char *title)
 {
+   int p = appData.defProtocol;
    if(*engineListFile) ParseSettingsFile(engineListFile, &engineListFile); // contains engine list
+   if(p >= 0 && p < 5) protocolChoice = protocols[p];
    isUCI = isUSI = storeVariant = v1 = useNick = False; addToList = hasBook = True; // defaults
    secondEng = engineNr;
    if(engineLine)   free(engineLine);   engineLine = strdup("");