X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=pgntags.c;h=fd74df7fd151f610589fbea4749b627ee8ed1c90;hb=59238430e1f2b02188a347078dc28ba71b4b14c1;hp=23957f6e30ae4148ec3f9fc8db9db0f175cf97b9;hpb=4e062d14429ed3a3a251c971690bade4c8cba946;p=xboard.git diff --git a/pgntags.c b/pgntags.c index 23957f6..fd74df7 100644 --- a/pgntags.c +++ b/pgntags.c @@ -1,7 +1,7 @@ /* * pgntags.c -- Functions to manage PGN tags * - * Copyright 1995, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. * * Enhancements Copyright 2005 Alessandro Scotti * @@ -114,8 +114,13 @@ ParsePGNTag (char *tag, GameInfo *gameInfo) success = TRUE; } else if (StrCaseCmp(name, "Variant") == 0) { /* xboard-defined extension */ - gameInfo->variant = StringToVariant(value); - success = TRUE; + success = StrSavePtr(value, &gameInfo->variantName) != NULL; + if(*value && strcmp(value, engineVariant)) // keep current engine-defined variant if it matches + gameInfo->variant = StringToVariant(value); + } else if (StrCaseCmp(name, "VariantMen") == 0) { + /* for now ignore this tag, as we have no method yet */ + /* for assigning the pieces to XBoard pictograms */ + success = TRUE; } else if (StrCaseCmp(name, PGN_OUT_OF_BOOK) == 0) { /* [AS] Out of book annotation */ success = StrSavePtr(value, &gameInfo->outOfBook) != NULL; @@ -144,6 +149,7 @@ ParsePGNTag (char *tag, GameInfo *gameInfo) void PrintPGNTags (FILE *fp, GameInfo *gameInfo) { + char *p; fprintf(fp, "[Event \"%s\"]\n", gameInfo->event ? gameInfo->event : "?"); fprintf(fp, "[Site \"%s\"]\n", gameInfo->site ? gameInfo->site : "?"); fprintf(fp, "[Date \"%s\"]\n", gameInfo->date ? gameInfo->date : "?"); @@ -159,6 +165,8 @@ PrintPGNTags (FILE *fp, GameInfo *gameInfo) fprintf(fp, "[TimeControl \"%s\"]\n", gameInfo->timeControl); if (gameInfo->variant != VariantNormal) fprintf(fp, "[Variant \"%s\"]\n", VariantName(gameInfo->variant)); + if (*(p = CollectPieceDescriptors())) + fprintf(fp, "[VariantMen \"%s\"]\n", p); if (gameInfo->extraTags) fputs(gameInfo->extraTags, fp); }