|
|
|
|
@ -374,26 +374,29 @@ public class Race implements Runnable {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//Otherwise, the race is over!
|
|
|
|
|
System.out.println("test");
|
|
|
|
|
raceFinished.start();
|
|
|
|
|
setRaceStatusEnum(RaceStatusEnum.FINISHED);
|
|
|
|
|
this.stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Change wind direction
|
|
|
|
|
changeWindDir();
|
|
|
|
|
if (getNumberOfActiveBoats() != 0) {
|
|
|
|
|
// Change wind direction
|
|
|
|
|
changeWindDir();
|
|
|
|
|
|
|
|
|
|
//Parse the boat locations.
|
|
|
|
|
parseBoatLocations();
|
|
|
|
|
//Parse the boat locations.
|
|
|
|
|
parseBoatLocations();
|
|
|
|
|
|
|
|
|
|
//Parse the marks.
|
|
|
|
|
parseMarks();
|
|
|
|
|
//Parse the marks.
|
|
|
|
|
parseMarks();
|
|
|
|
|
|
|
|
|
|
//Parse the race status.
|
|
|
|
|
parseRaceStatus();
|
|
|
|
|
//Parse the race status.
|
|
|
|
|
parseRaceStatus();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Update the last frame time.
|
|
|
|
|
this.lastFrameTime = currentTime;
|
|
|
|
|
//Update the last frame time.
|
|
|
|
|
this.lastFrameTime = currentTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -404,7 +407,7 @@ public class Race implements Runnable {
|
|
|
|
|
int iters = 0;
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long now) {
|
|
|
|
|
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 4, startTime, 0, 2300, 2, null);
|
|
|
|
|
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 4, startTime, 0, 2300, 2, new ArrayList<>());
|
|
|
|
|
mockOutput.parseRaceStatus(raceStatus);
|
|
|
|
|
if (iters > 500){
|
|
|
|
|
mockOutput.stop();
|
|
|
|
|
@ -625,10 +628,10 @@ public class Race implements Runnable {
|
|
|
|
|
boat.setVMG(newVMG);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.updateEstimatedTime(boat);
|
|
|
|
|
//Check the boats position (update leg and stuff).
|
|
|
|
|
this.checkPosition(boat, totalTimeElapsed);
|
|
|
|
|
this.updateEstimatedTime(boat);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -751,7 +754,6 @@ public class Race implements Runnable {
|
|
|
|
|
boat.setTimeFinished(timeElapsed);
|
|
|
|
|
boat.setCurrentSpeed(0);
|
|
|
|
|
boat.setStatus(BoatStatusEnum.FINISHED);
|
|
|
|
|
|
|
|
|
|
} else if (doNotFinish()) {
|
|
|
|
|
//Boat has pulled out of race.
|
|
|
|
|
boat.setTimeFinished(timeElapsed);
|
|
|
|
|
|