From: H.G. Muller Date: Wed, 17 Nov 2010 15:30:57 +0000 (+0100) Subject: Make undo work in Seirawan Chess X-Git-Tag: 4.8Q~13 X-Git-Url: http://winboard.nl/cgi-bin?p=fairymax.git;a=commitdiff_plain;h=cdb80be80d2895990ffe4b3f88ab566e5553ca3c Make undo work in Seirawan Chess The holdings were not restored before replaying the game. This has now been moved to InitGame(), which does it based on a gating flag set in LoadGame() if the variant name is "seirawan". --- diff --git a/fairymax.c b/fairymax.c index 072e67f..ce2d7ae 100644 --- a/fairymax.c +++ b/fairymax.c @@ -93,7 +93,7 @@ int Resign; int Threshold = 800; int Score; int makruk; -int prom, pm; +int prom, pm, gating; char piecename[32], piecetype[32], blacktype[32]; char selectedFairy[80]; char *inifile = INI_FILE; @@ -389,6 +389,7 @@ InitGame() R -= 2*(-k/FAC); UnderProm = -1; pl[WHITE] = pl[BLACK] = 2*BW; pm = !pl[BLACK+7] && pl[BLACK+9] && pl[WHITE+7] ? 2 : 0; // Unlike white, black has no 'Q', so promote to 9, which he does have. + if(gating) pl[13] = pl[15] = pl[29] = pl[31] = 1, R += 2*(w[6]/FAC + w[8]/FAC); } void CopyBoard(int s) @@ -454,9 +455,11 @@ int LoadGame(char *name) if(fscanf(f, "version 4.8(%c)", &c)!=1 || c != 'w') { printf("telluser incompatible fmax.ini file\n"); exit(0); } + gating = 0; if(name != NULL) { /* search for game name in definition file */ - if(!strcmp(name, "fairy")) name = selectedFairy; + if(!strcmp(name, "fairy")) name = selectedFairy; + gating = !strcmp(name, "seirawan"); while((ptc=fscanf(f, "Game: %s # %s", buf, pieceToChar))==0 || strcmp(name, buf) ) { while((c = fgetc(f)) != EOF && c != '\n'); count++; @@ -784,7 +787,6 @@ int main(int argc, char **argv) sscanf(line, "variant %s", command); LoadGame(command); InitGame(); Setup = 0; - if(strstr(command,"seirawan")) pl[13] = pl[15] = pl[29] = pl[31] = 1, R += 2*(w[6]/FAC + w[8]/FAC); continue; } if (!strcmp(command, "edit")) {