From 1a2052a0c7bf59ec549cf7f6ed11e5114f7b15c6 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 20 Oct 2011 12:39:10 +0200 Subject: [PATCH] Refine clock adjusting Adjusting the clocks by shift-clicking them is now only allowed with autoCallFlag off, and an error-popup results when you do it otherwise. Also, swtching to Edit Game mode won't reset the clocks to the stored value anymore when you have just adjusted it. --- backend.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/backend.c b/backend.c index 43f7926..e0bb52f 100644 --- a/backend.c +++ b/backend.c @@ -465,6 +465,7 @@ int have_sent_ICS_logon = 0; int movesPerSession; int suddenDeath, whiteStartMove, blackStartMove; /* [HGM] for implementation of 'any per time' sessions, as in first part of byoyomi TC */ long whiteTimeRemaining, blackTimeRemaining, timeControl, timeIncrement, lastWhite, lastBlack; +Boolean adjustedClock; long timeControl_2; /* [AS] Allow separate time controls */ char *fullTimeControlString = NULL, *nextSession, *whiteTC, *blackTC; /* [HGM] secondary TC: merge of MPS, TC and inc */ long timeRemaining[2][MAX_MOVES]; @@ -9438,6 +9439,7 @@ MakeMove(fromX, fromY, toX, toY, promoChar) SwitchClocks(forwardMostMove+1); // [HGM] race: incrementing move nr inside timeRemaining[0][forwardMostMove] = whiteTimeRemaining; timeRemaining[1][forwardMostMove] = blackTimeRemaining; + adjustedClock = FALSE; gameInfo.result = GameUnfinished; if (gameInfo.resultDetails != NULL) { free(gameInfo.resultDetails); @@ -13415,9 +13417,11 @@ EditGameEvent() SendToProgram("undo\n", &first); i--; } + if(!adjustedClock) { whiteTimeRemaining = timeRemaining[0][currentMove]; blackTimeRemaining = timeRemaining[1][currentMove]; DisplayBothClocks(); + } if (whiteFlag || blackFlag) { whiteFlag = blackFlag = 0; } @@ -15739,9 +15743,11 @@ NextTickLength(timeRemaining) void AdjustClock(Boolean which, int dir) { + if(appData.autoCallFlag) { DisplayError(_("Clock adjustment not allowed in auto-flag mode"), 0); return; } if(which) blackTimeRemaining += 60000*dir; else whiteTimeRemaining += 60000*dir; DisplayBothClocks(); + adjustedClock = TRUE; } /* Stop clocks and reset to a fresh time control */ @@ -15765,6 +15771,7 @@ ResetClocks() } lastWhite = lastBlack = whiteStartMove = blackStartMove = 0; DisplayBothClocks(); + adjustedClock = FALSE; } #define FUDGE 25 /* 25ms = 1/40 sec; should be plenty even for 50 Hz clocks */ -- 1.7.0.4