Send parent variant with setup command
[fairymax.git] / fairymax.c
index 5341cd2..f80bfe3 100644 (file)
@@ -342,6 +342,7 @@ int PrintResult(int s)
             }\r
           differs: ;\r
         }\r
+\r
         K=I;\r
         cnt = D(s,-I,I,Q,O,LL|4*S,3);\r
 #ifdef SHATRANJ\r
@@ -438,7 +439,7 @@ void PrintVariants(int combo)
                while((c = fgetc(f)) != EOF && c != '\n');\r
            if(c == EOF) break;\r
            total++;\r
-           if(combo == (strstr(buf, "fairy/") != buf)) continue;\r
+           if(*buf < 'a' || combo == (strstr(buf, "fairy/") != buf)) continue;\r
            if(combo && count == 0) strcpy(selectedFairy, buf);\r
            if(count++) printf(combo ? " /// " : ",");\r
            printf("%s", combo ? buf+6 : buf);\r
@@ -455,7 +456,7 @@ void PrintOptions()
        printf("feature option=\"Ini File -file %s\"\n", inifile);\r
        printf("feature option=\"Multi-PV Margin -spin %d 0 1000\"\n", margin);\r
        printf("feature option=\"Variant fairy selects -combo "); PrintVariants(1); printf("\"\n");\r
-       printf("feature option=\"Makruk rules -combo makruk /// cambodian /// ai-wok\"\n");\r
+       printf("feature option=\"Makruk rules -combo makruk /// Cambodian /// Ai-wok\"\n");\r
        printf("feature option=\"Dummy Slider Example -slider 20 0 100\"\n");\r
        printf("feature option=\"Dummy String Example -string happy birthday!\"\n");\r
        printf("feature option=\"Dummy Path Example -path .\"\n");\r
@@ -465,7 +466,7 @@ void PrintOptions()
                                          \r
 void LoadGame(char *name)\r
 {\r
-        int i, j, ptc, count=0; char c, buf[80], pieceToChar[80];\r
+        int i, j, ptc, count=0; char c, buf[80], pieceToChar[80], parent[80];\r
         static int currentVariant;\r
         FILE *f;\r
 \r
@@ -483,7 +484,7 @@ void LoadGame(char *name)
            if(!strcmp(name, "makruk")) name = Cambodian; else\r
            if(!strcmp(name, "fairy")) name = selectedFairy;\r
            gating = !strcmp(name, "seirawan");\r
-           while((ptc=fscanf(f, "Game: %s # %s", buf, pieceToChar))==0 || strcmp(name, buf) ) {\r
+           while((ptc=fscanf(f, "Game: %s # %s # %s", buf, pieceToChar, parent))==0 || strcmp(name, buf) ) {\r
                while((c = fgetc(f)) != EOF && c != '\n');\r
                count++;\r
                if(c == EOF) {\r
@@ -522,8 +523,9 @@ void LoadGame(char *name)
 \r
         fclose(f);\r
        sh = w[7] < 250 ? 3 : 0;\r
-        if(name == selectedFairy || makruk) {\r
-            printf(ptc == 1 ? "setup " : "setup (%s) ", pieceToChar); // setup board in GUI\r
+        if(ptc > 1) { // setup board in GUI, by sending it pieceToCharTable and FEN\r
+            if(ptc == 2) printf("setup (%s) ", pieceToChar);\r
+            else printf("setup (%s) %dx%d+0_%s ", pieceToChar, BW, BH, parent);\r
             for(i=0; i<BW; i++) printf("%c", piecename[oo[i+16]]+'`'); printf("/");\r
             if(makruk) printf("8/");\r
             for(i=0; i<BW; i++) printf("%c", piecename[2]+'`'); printf("/");\r