From: H.G.Muller Date: Thu, 26 Dec 2013 20:54:54 +0000 (+0100) Subject: Send parent variant with setup command X-Git-Url: http://winboard.nl/cgi-bin?p=fairymax.git;a=commitdiff_plain;h=cf491054b45bbe4954256d926f8eac6deaad54b7 Send parent variant with setup command Implement WinBoard's extended setup command, which also specifies board size and parent variant. The parent variant can be specified in the fmax.ini file behind the pieceToCharTable. --- diff --git a/fairymax.c b/fairymax.c index f9cf637..46b3890 100644 --- a/fairymax.c +++ b/fairymax.c @@ -491,7 +491,7 @@ void PrintOptions() void LoadGame(char *name) { - int i, j, ptc, count=0; char c, buf[80], pieceToChar[80]; + int i, j, ptc, count=0; char c, buf[80], pieceToChar[80], parent[80]; static int currentVariant; FILE *f; @@ -509,7 +509,7 @@ void LoadGame(char *name) if(!strcmp(name, "makruk") && Cambodian) name = "cambodian"; else if(!strcmp(name, "fairy")) name = selectedFairy; gating = !strcmp(name, "seirawan"); - while((ptc=fscanf(f, "Game: %s # %s", buf, pieceToChar))==0 || strcmp(name, buf) ) { + while((ptc=fscanf(f, "Game: %s # %s %s", buf, pieceToChar, parent))==0 || strcmp(name, buf) ) { while((c = fgetc(f)) != EOF && c != '\n'); count++; if(c == EOF) { @@ -552,8 +552,9 @@ void LoadGame(char *name) fclose(f); sh = w[7] < 250 ? 3 : 0; makruk = w[7]==181 ? 64 : 0; // w[7] is used as kludge to enable makruk promotions - if(name == selectedFairy) { - printf(ptc == 1 ? "setup " : "setup (%s) ", pieceToChar); // setup board in GUI + if(ptc > 1) { // setup board in GUI, by sending it pieceToCharTable and FEN + if(ptc == 2) printf("setup (%s) ", pieceToChar); + else printf("setup (%s) %dx%d+0_%s", pieceToChar, BW, BH, parent); for(i=0; i