Support printing of piece command specified in ini file
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 20 Sep 2014 08:25:59 +0000 (10:25 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 20 Sep 2014 09:27:48 +0000 (11:27 +0200)
Lines behind the game definition starting with # (after an empty
such line) are sent to the GUI with a 'piece' prefix. This allows
Fairy-Max to implement the new XBoard protocol for communicating
piece moves to the GUI, so the latter can do legality testing and
better SAN generation.

data/fmax.ini
fairymax.c

index 7cae580..ea064e8 100644 (file)
@@ -140,6 +140,8 @@ Line 1:     Board size (files x ranks). Ranks must currently still be 8.
 Line 2:     initial setup of white pieces on back rank\r
 Line 3:     initial setup of black pieces on back rank\r
 Line 4-18:  Description of piece types that can occur in the variant\r
+This can be followed by some optional info to be sent to GUI when it\r
+selects the variant, e.g. to tell it how some non-standard pieces move.\r
 \r
 There can be upto 15 piece types per variant, numbered 1 to 15.\r
 Numbers 1 and 2 are considered Pawns for white and black, respectively,\r
index f20bb1f..f476379 100644 (file)
@@ -525,7 +525,6 @@ void LoadGame(char *name)
             c=0; if(i>15 || j>255) break;\r
         }\r
 \r
-        fclose(f);\r
        sh = w[7] < 250 ? 3 : 0;\r
         if(ptc > 1) { // setup board in GUI, by sending it pieceToCharTable and FEN\r
             if(ptc == 2) printf("setup (%s) ", pieceToChar);\r
@@ -538,6 +537,8 @@ void LoadGame(char *name)
             if(makruk) printf("8/");\r
             for(i=0; i<BW; i++) printf("%c", piecename[oo[i]]+'@'); printf(" w KQkq - 0 1\n");\r
         }\r
+       while(fscanf(f, " # %[^\n]", pieceToChar)) printf("piece %s\n", pieceToChar);\r
+        fclose(f);\r
 }\r
 \r
 int main(int argc, char **argv)\r