From 8560d1251e7d8cc3f2362ced5d33eaca82f2bc16 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 7 Mar 2013 17:52:02 +0100 Subject: [PATCH] Fix saving of analyzed game Anotated games after batch-mode Analyze Game were not auto-saved, because the GameEnds() call supposed to do that was called with a NULL argument for resultDetails. Now it is called with the resultDetails as pre-existing in the gameInfo, or an empty string if none exist. This bug was masked by the fact that in standard game ends (mate, etc.) the analyzing engine would declare game end and supply a message. Also makes a distinction between Analyze Game and regular Analyze mode when resuming analysis after loading a game; only the former now would trigger a batch analysis. --- backend.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index 0c555f9..b3c152e 100644 --- a/backend.c +++ b/backend.c @@ -11193,7 +11193,7 @@ AutoPlayOneMove () if (currentMove >= forwardMostMove) { if(gameMode == AnalyzeFile) { if(appData.loadGameIndex == -1) { - GameEnds(EndOfFile, NULL, GE_FILE); + GameEnds(gameInfo.result, gameInfo.resultDetails ? gameInfo.resultDetails : "", GE_FILE); ScheduleDelayedEvent(AnalyzeNextGame, 10); } else { ExitAnalyzeMode(); SendToProgram("force\n", &first); @@ -12439,10 +12439,12 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList) HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1); - if (oldGameMode == AnalyzeFile || - oldGameMode == AnalyzeMode) { + if (oldGameMode == AnalyzeFile) { appData.loadGameIndex = -1; // [HGM] order auto-stepping through games AnalyzeFileEvent(); + } else + if (oldGameMode == AnalyzeMode) { + AnalyzeFileEvent(); } if(creatingBook) return TRUE; -- 1.7.0.4