mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-20 04:32:17 +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,9 +2852,8 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
blackTitleText.setText(headers.get("Black"));
|
blackTitleText.setText(headers.get("Black"));
|
||||||
}
|
}
|
||||||
handlerTimer.removeCallbacks(r);
|
handlerTimer.removeCallbacks(r);
|
||||||
if (nextUpdate > 0) {
|
if (nextUpdate > 0)
|
||||||
handlerTimer.postDelayed(r, nextUpdate);
|
handlerTimer.postDelayed(r, nextUpdate);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PngTokenReceiver implementation that renders PGN data for screen display. */
|
/** PngTokenReceiver implementation that renders PGN data for screen display. */
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ public class DroidChessController {
|
|||||||
long nextUpdate = 0;
|
long nextUpdate = 0;
|
||||||
if (game.timeController.clockRunning()) {
|
if (game.timeController.clockRunning()) {
|
||||||
long t = game.currPos().whiteMove ? wTime : bTime;
|
long t = game.currPos().whiteMove ? wTime : bTime;
|
||||||
nextUpdate = (t % 1000);
|
nextUpdate = t % 1000;
|
||||||
if (nextUpdate < 0) nextUpdate += 1000;
|
if (nextUpdate < 0) nextUpdate += 1000;
|
||||||
nextUpdate += 1;
|
nextUpdate += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,8 +169,9 @@ public class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final void updateTimeControl(boolean discardElapsed) {
|
private final void updateTimeControl(boolean discardElapsed) {
|
||||||
int move = currPos().fullMoveCounter;
|
Position currPos = currPos();
|
||||||
boolean wtm = currPos().whiteMove;
|
int move = currPos.fullMoveCounter;
|
||||||
|
boolean wtm = currPos.whiteMove;
|
||||||
if (discardElapsed || (move != timeController.currentMove) || (wtm != timeController.whiteToMove)) {
|
if (discardElapsed || (move != timeController.currentMove) || (wtm != timeController.whiteToMove)) {
|
||||||
int initialTime = timeController.getInitialTime();
|
int initialTime = timeController.getInitialTime();
|
||||||
int whiteBaseTime = tree.getRemainingTime(true, initialTime);
|
int whiteBaseTime = tree.getRemainingTime(true, initialTime);
|
||||||
@@ -178,7 +179,15 @@ public class Game {
|
|||||||
timeController.setCurrentMove(move, wtm, whiteBaseTime, blackBaseTime);
|
timeController.setCurrentMove(move, wtm, whiteBaseTime, blackBaseTime);
|
||||||
}
|
}
|
||||||
long now = System.currentTimeMillis();
|
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);
|
timeController.stopTimer(now);
|
||||||
} else {
|
} else {
|
||||||
timeController.startTimer(now);
|
timeController.startTimer(now);
|
||||||
|
|||||||
Reference in New Issue
Block a user