DroidFish: Don't start the white clock in the initial position. It is not nice that the clock starts running immediately when you first start the program.

This commit is contained in:
Peter Osterlund
2012-09-02 07:54:44 +00:00
parent 7bbf888eb1
commit 3d12ab7f59
3 changed files with 14 additions and 6 deletions

View File

@@ -2852,9 +2852,8 @@ public class DroidFish extends Activity implements GUIInterface {
blackTitleText.setText(headers.get("Black"));
}
handlerTimer.removeCallbacks(r);
if (nextUpdate > 0) {
if (nextUpdate > 0)
handlerTimer.postDelayed(r, nextUpdate);
}
}
/** PngTokenReceiver implementation that renders PGN data for screen display. */

View File

@@ -489,7 +489,7 @@ public class DroidChessController {
long nextUpdate = 0;
if (game.timeController.clockRunning()) {
long t = game.currPos().whiteMove ? wTime : bTime;
nextUpdate = (t % 1000);
nextUpdate = t % 1000;
if (nextUpdate < 0) nextUpdate += 1000;
nextUpdate += 1;
}

View File

@@ -169,8 +169,9 @@ public class Game {
}
private final void updateTimeControl(boolean discardElapsed) {
int move = currPos().fullMoveCounter;
boolean wtm = currPos().whiteMove;
Position currPos = currPos();
int move = currPos.fullMoveCounter;
boolean wtm = currPos.whiteMove;
if (discardElapsed || (move != timeController.currentMove) || (wtm != timeController.whiteToMove)) {
int initialTime = timeController.getInitialTime();
int whiteBaseTime = tree.getRemainingTime(true, initialTime);
@@ -178,7 +179,15 @@ public class Game {
timeController.setCurrentMove(move, wtm, whiteBaseTime, blackBaseTime);
}
long now = System.currentTimeMillis();
if (gamePaused || (getGameState() != GameState.ALIVE)) {
boolean stopTimer = gamePaused || (getGameState() != GameState.ALIVE);
if (!stopTimer) {
try {
if (TextIO.readFEN(TextIO.startPosFEN).equals(currPos))
stopTimer = true;
} catch (ChessParseError e) {
}
}
if (stopTimer) {
timeController.stopTimer(now);
} else {
timeController.startTimer(now);