X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=c19666281f2aa2d11b7147c7d26119c1060a1d59;hb=d3c211c5c2ebfb2e77a6dc37c973ce7d69f301fd;hp=a4564d8b23ba77db1367c196f946467f0383687f;hpb=657beffbe986b3969f625dfe25203dae521ba797;p=xboard.git diff --git a/backend.c b/backend.c index a4564d8..c196662 100644 --- a/backend.c +++ b/backend.c @@ -393,6 +393,7 @@ PosFlags (index) } FILE *gameFileFP, *debugFP; +char *currentDebugFile; // [HGM] debug split: to remember name /* [AS] Note: sometimes, the sscanf() function is used to parse the input @@ -1325,6 +1326,7 @@ InitBackEnd2 () if (appData.debugMode) { fprintf(debugFP, "%s\n", programVersion); } + ASSIGN(currentDebugFile, appData.nameOfDebugFile); // [HGM] debug split: remember initial name in use set_cont_sequence(appData.wrapContSeq); if (appData.matchGames > 0) { @@ -12328,6 +12330,8 @@ SaveGamePGN (FILE *f) PrintPGNTags(f, &gameInfo); + if(appData.numberTag && matchMode) fprintf(f, "[Number \"%d\"]\n", nextGame+1); // [HGM] number tag + if (backwardMostMove > 0 || startedFromSetupPosition) { char *fen = PositionToFEN(backwardMostMove, NULL); fprintf(f, "[FEN \"%s\"]\n[SetUp \"1\"]\n", fen); @@ -13404,6 +13408,17 @@ TwoMachinesEvent P((void)) break; } + if(matchMode && appData.debugMode) { // [HGM] debug split: game is part of a match; we might have to create a debug file just for this game + snprintf(buf, MSG_SIZ, appData.nameOfDebugFile, nextGame+1); // expand name of debug file with %d in it + if(strcmp(buf, currentDebugFile)) { // name has changed + FILE *f = fopen(buf, "w"); + if(f) { // if opening the new file failed, just keep using the old one + ASSIGN(currentDebugFile, buf); + fclose(debugFP); + debugFP = f; + } + } + } // forwardMostMove = currentMove; TruncateGame(); // [HGM] vari: MachineWhite and MachineBlack do this... @@ -13429,6 +13444,7 @@ TwoMachinesEvent P((void)) ScheduleDelayedEvent(TwoMachinesEventIfReady, appData.matchPause - wait); return; } + // we are now committed to starting the game stalling = 0; DisplayMessage("", ""); if (startedFromSetupPosition) { @@ -15619,6 +15635,14 @@ TypeInDoneEvent (char *move) ToNrEvent(2*n-1); return; } + // undocumented kludge: allow command-line option to be typed in! + // (potentially fatal, and does not implement the effect of the option.) + // should only be used for options that are values on which future decisions will be made, + // and definitely not on options that would be used during initialization. + if(strstr(move, "!!! -") == move) { + ParseArgsFromString(move+4); + return; + } if (gameMode != EditGame && currentMove != forwardMostMove && gameMode != Training) {