|
|
|
|
@ -92,7 +92,7 @@ public abstract class Race implements Runnable {
|
|
|
|
|
remainingSeconds = currentTimeInSeconds % 60;
|
|
|
|
|
hours = minutes / 60;
|
|
|
|
|
minutes = minutes % 60;
|
|
|
|
|
updateTime(String.format("%02d:%02d:%02d", hours, minutes, remainingSeconds));
|
|
|
|
|
updateTime(String.format("Time until race starts: %02d:%02d:%02d", hours, minutes, remainingSeconds));
|
|
|
|
|
try {
|
|
|
|
|
timeLoopEnded = System.currentTimeMillis();
|
|
|
|
|
Thread.sleep(SLEEP_TIME - (timeLoopEnded - currentTime));
|
|
|
|
|
@ -114,7 +114,7 @@ public abstract class Race implements Runnable {
|
|
|
|
|
remainingSeconds = currentTimeInSeconds % 60;
|
|
|
|
|
hours = minutes / 60;
|
|
|
|
|
minutes = minutes % 60;
|
|
|
|
|
return String.format("%02d:%02d:%02d", hours, minutes, remainingSeconds);
|
|
|
|
|
return String.format("Race clock: %02d:%02d:%02d", hours, minutes, remainingSeconds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateTime(String time){
|
|
|
|
|
@ -167,7 +167,7 @@ public abstract class Race implements Runnable {
|
|
|
|
|
*/
|
|
|
|
|
protected void checkPosition(BoatInRace boat, long timeElapsed) {
|
|
|
|
|
if (boat.getDistanceTravelledInLeg() > boat.getCurrentLeg().getDistance()){
|
|
|
|
|
//updateController(); removed as we do not update the table every time anymore.
|
|
|
|
|
// updateController();
|
|
|
|
|
//boat has passed onto new leg
|
|
|
|
|
if (boat.getCurrentLeg().getName().equals("Finish")) {
|
|
|
|
|
//boat has finished
|
|
|
|
|
@ -176,6 +176,7 @@ public abstract class Race implements Runnable {
|
|
|
|
|
} else {
|
|
|
|
|
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg() - boat.getCurrentLeg().getDistance());
|
|
|
|
|
Leg nextLeg = legs.get(boat.getCurrentLeg().getLegNumber() + 1);
|
|
|
|
|
|
|
|
|
|
boat.setCurrentLeg(nextLeg);
|
|
|
|
|
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg());
|
|
|
|
|
}
|
|
|
|
|
|