Fix variant choice for second engine
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 1 Sep 2013 20:11:30 +0000 (22:11 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sun, 1 Sep 2013 20:11:30 +0000 (22:11 +0200)
backend.c
dialogs.c
winboard/woptions.c

index 78e8431..46e888e 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2011,7 +2011,7 @@ char *variantNames[] = VARIANT_NAMES;
 char *
 VariantName (VariantClass v)
 {
 char *
 VariantName (VariantClass v)
 {
-    if(v == VariantUnknown) return engineVariant;
+    if(v == VariantUnknown || *engineVariant) return engineVariant;
     return variantNames[v];
 }
 
     return variantNames[v];
 }
 
@@ -10003,7 +10003,7 @@ NonStandardBoardSize ()
 {
       /* [HGM] Awkward testing. Should really be a table */
       int overruled = gameInfo.boardWidth != 8 || gameInfo.boardHeight != 8 || gameInfo.holdingsSize != 0;
 {
       /* [HGM] Awkward testing. Should really be a table */
       int overruled = gameInfo.boardWidth != 8 || gameInfo.boardHeight != 8 || gameInfo.holdingsSize != 0;
-      if( gameInfo.variant == VariantUnknown ) return 0; // engine-defined name never needs prefix
+      if( gameInfo.variant == VariantUnknown || *engineVariant) return 0; // engine-defined name never needs prefix
       if( gameInfo.variant == VariantXiangqi )
            overruled = gameInfo.boardWidth != 9 || gameInfo.boardHeight != 10 || gameInfo.holdingsSize != 0;
       if( gameInfo.variant == VariantShogi )
       if( gameInfo.variant == VariantXiangqi )
            overruled = gameInfo.boardWidth != 9 || gameInfo.boardHeight != 10 || gameInfo.holdingsSize != 0;
       if( gameInfo.variant == VariantShogi )
index da0f4a1..cf7b85a 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -468,7 +468,7 @@ static void
 Pick (int n)
 {
        VariantClass v = variantDescriptors[n].value;
 Pick (int n)
 {
        VariantClass v = variantDescriptors[n].value;
-       if(v == VariantUnknown) safeStrCpy(engineVariant, variantDescriptors[n].name, MSG_SIZ);
+       if(v == VariantUnknown) safeStrCpy(engineVariant, variantDescriptors[n].name, MSG_SIZ); else *engineVariant = NULLCHAR;
        if(!appData.noChessProgram) {
            char *name = VariantName(v), buf[MSG_SIZ];
            if (first.protocolVersion > 1 && StrStr(first.variants, name) == NULL) {
        if(!appData.noChessProgram) {
            char *name = VariantName(v), buf[MSG_SIZ];
            if (first.protocolVersion > 1 && StrStr(first.variants, name) == NULL) {
index b997fd4..a736306 100644 (file)
@@ -874,6 +874,7 @@ VariantWhichRadio(HWND hDlg)
        if(IsDlgButtonChecked(hDlg, j) &&\r
           (appData.noChessProgram || strstr(first.variants, VariantName(i-1)))) return (VariantClass) i-1;\r
   }\r
        if(IsDlgButtonChecked(hDlg, j) &&\r
           (appData.noChessProgram || strstr(first.variants, VariantName(i-1)))) return (VariantClass) i-1;\r
   }\r
+  *engineVariant = NULLCHAR;\r
   for(i=0; i<9; i++) { // check for engine-defined variants\r
     if(IsDlgButtonChecked(hDlg, OPT_EngineVariant+i) ) {\r
        GetDlgItemText(hDlg, OPT_EngineVariant+i, engineVariant, MSG_SIZ); // remember name, so we can resolve it later\r
   for(i=0; i<9; i++) { // check for engine-defined variants\r
     if(IsDlgButtonChecked(hDlg, OPT_EngineVariant+i) ) {\r
        GetDlgItemText(hDlg, OPT_EngineVariant+i, engineVariant, MSG_SIZ); // remember name, so we can resolve it later\r