mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-19 20:22:18 +01:00
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:
@@ -2852,10 +2852,9 @@ 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. */
|
||||
static class PgnScreenText implements PgnToken.PgnTokenReceiver {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user