|
|
|
|
@ -32,7 +32,7 @@ public class Race implements Runnable {
|
|
|
|
|
protected int boatsFinished = 0;
|
|
|
|
|
protected long totalTimeElapsed;
|
|
|
|
|
protected int scaleFactor;
|
|
|
|
|
protected int PRERACE_TIME = 180; //time in milliseconds to pause during pre-race. At the moment, 3 minutes
|
|
|
|
|
protected int PRERACE_TIME = 180000; //time in milliseconds to pause during pre-race. At the moment, 3 minutes
|
|
|
|
|
protected boolean countdownFinish = false;
|
|
|
|
|
protected boolean runRace = true;
|
|
|
|
|
private int lastFPS = 20;
|
|
|
|
|
@ -118,7 +118,6 @@ public class Race implements Runnable {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long arg0) {
|
|
|
|
|
timeLeft = startTime - currentTime;
|
|
|
|
|
System.out.println(timeLeft);
|
|
|
|
|
ArrayList<BoatStatusMessage> boatStatusMessages = new ArrayList<>();
|
|
|
|
|
//For each boat, we update it's position, and generate a BoatLocationMessage.
|
|
|
|
|
for (int i = 0; i < startingBoats.size(); i++) {
|
|
|
|
|
@ -140,7 +139,6 @@ public class Race implements Runnable {
|
|
|
|
|
if (runRace) {
|
|
|
|
|
simulateRace();
|
|
|
|
|
}
|
|
|
|
|
System.out.println("Stopping");
|
|
|
|
|
stop();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
@ -188,7 +186,7 @@ public class Race implements Runnable {
|
|
|
|
|
updatePosition(boat, Math.round(1000 / lastFPS) > 20 ? 15 : Math.round(1000 / lastFPS));
|
|
|
|
|
checkPosition(boat, totalTimeElapsed);
|
|
|
|
|
}
|
|
|
|
|
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading(), boat.getScaledVelocity());
|
|
|
|
|
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading(), boat.getVelocity());
|
|
|
|
|
boatStatusMessages.add(new BoatStatusMessage(boat.getSourceID(),
|
|
|
|
|
boat.getCurrentLeg().getLegNumber() >= 0 ? BoatStatus.RACING : BoatStatus.DNF, boat.getCurrentLeg().getLegNumber()));
|
|
|
|
|
} else {
|
|
|
|
|
|