X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=d78319a3d78b9639be099a5cbff0b1e7fd0021b7;hb=7d2cf8e719aefa423f406fbf094e59b37a2c7ef1;hp=4b09ab80bf1e31ebc3e035370408e69e2473e336;hpb=961180c518bc7939a4b35dcb9f651176a6141e48;p=xboard.git diff --git a/backend.c b/backend.c index 4b09ab8..d78319a 100644 --- a/backend.c +++ b/backend.c @@ -224,6 +224,7 @@ FILE *WriteTourneyFile P((char *results, FILE *f)); void DisplayTwoMachinesTitle P(()); static void ExcludeClick P((int index)); void ToggleSecond P((void)); +void PauseEngine P((ChessProgramState *cps)); #ifdef WIN32 extern void ConsoleCreate(); @@ -8111,9 +8112,13 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h if(appData.debugMode) fprintf(debugFP, "pause %s engine after move\n", cps->which); safeStrCpy(stashedInputMove, message, MSG_SIZ); stalledEngine = cps; - if(appData.ponderNextMove) { // bring both engines out of ponder - SendToProgram("easy\n", &first); - if(gameMode == TwoMachinesPlay) SendToProgram("easy\n", &second); + if(appData.ponderNextMove) { // bring opponent out of ponder + if(gameMode == TwoMachinesPlay) { + if(cps->other->pause) + PauseEngine(cps->other); + else + SendToProgram("easy\n", cps->other); + } } StopClocks(); return; @@ -12340,9 +12345,7 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList) if (oldGameMode == AnalyzeFile || oldGameMode == AnalyzeMode) { appData.loadGameIndex = -1; // [HGM] order auto-stepping through games - keepInfo = 1; AnalyzeFileEvent(); - keepInfo = 0; } if(creatingBook) return TRUE; @@ -13404,7 +13407,7 @@ PauseEvent () if(stalledEngine) { // [HGM] pause: resume game by releasing withheld move StartClocks(); if(gameMode == TwoMachinesPlay) { // we might have to make the opponent resume pondering - if(stalledEngine->other->pause) UnPauseEngine(stalledEngine->other); + if(stalledEngine->other->pause == 2) UnPauseEngine(stalledEngine->other); else if(appData.ponderNextMove) SendToProgram("hard\n", stalledEngine->other); } if(appData.ponderNextMove) SendToProgram("hard\n", stalledEngine); @@ -13470,16 +13473,16 @@ PauseEvent () else SendToProgram("easy\n", onMove->other); StopClocks(); - } + } else if(appData.ponderNextMove) SendToProgram("easy\n", onMove); // pre-emptively bring out of ponder } else if(gameMode == (WhiteOnMove(forwardMostMove) ? MachinePlaysWhite : MachinePlaysBlack)) { // engine on move if(first.pause) { PauseEngine(&first); StopClocks(); - } + } else if(appData.ponderNextMove) SendToProgram("easy\n", &first); // pre-emptively bring out of ponder } else { // human on move, pause pondering by either method if(first.pause) PauseEngine(&first); - else + else if(appData.ponderNextMove) SendToProgram("easy\n", &first); StopClocks(); } @@ -13619,7 +13622,9 @@ AnalyzeFileEvent () } if (gameMode != AnalyzeMode) { + keepInfo = 1; // mere annotating should not alter PGN tags EditGameEvent(); + keepInfo = 0; if (gameMode != EditGame) return; if (!appData.showThinking) ToggleShowThinking(); ResurrectChessProgram(); @@ -13632,7 +13637,6 @@ AnalyzeFileEvent () gameMode = AnalyzeFile; pausing = FALSE; ModeHighlight(); - SetGameInfo(); StartAnalysisClock(); GetTimeMark(&lastNodeCountTime);