Currently, mock/pom.xml and visualiser/pom.xml build racevisionGame mock and visualiser.
Now using jetbrains nullable/notnull instead of sun (was causing maven issues).
This commit is contained in:
@@ -104,19 +104,18 @@ public class VisualiserBoat extends Boat {
|
||||
|
||||
/**
|
||||
* Attempts to add a new point to boat's track.
|
||||
* It only adds a new point if the boat is still racing (see {@link #getStatus()} and {@link BoatStatusEnum#RACING}), and if at least {@link #trackPointTimeInterval} milliseconds have occurred.
|
||||
* It only adds a new point if the boat is still racing (see {@link #getStatus()} and {@link BoatStatusEnum#RACING}), and if at least {@link #trackPointTimeInterval} milliseconds have occurred, using race time.
|
||||
* @param coordinate The {@link GPSCoordinate} of the trackpoint.
|
||||
* @param currentTime The current race time.
|
||||
* @see TrackPoint
|
||||
*/
|
||||
public void addTrackPoint(GPSCoordinate coordinate) {
|
||||
|
||||
//TODO bugfix: instead of creating a track point every #trackPointTimeInterval milliseconds of real time, we should base it off of race time, so that we will create a consistent number of track points regardless of what the race time scale is.
|
||||
public void addTrackPoint(GPSCoordinate coordinate, ZonedDateTime currentTime) {
|
||||
|
||||
//Get current time.
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long currentTimeMilli = currentTime.toInstant().toEpochMilli();
|
||||
|
||||
//Check if enough time has passed to create a new track point.
|
||||
Boolean canBeAdded = currentTime >= nextValidTime;
|
||||
Boolean canBeAdded = currentTimeMilli >= nextValidTime;
|
||||
|
||||
//If it has, and if we are still racing, create the point.
|
||||
if (canBeAdded && (getStatus() == BoatStatusEnum.RACING)) {
|
||||
@@ -125,11 +124,11 @@ public class VisualiserBoat extends Boat {
|
||||
long expiryPeriod = trackPointTimeInterval * trackPointLimit;
|
||||
|
||||
//Create and add point.
|
||||
TrackPoint trackPoint = new TrackPoint(coordinate, currentTime, expiryPeriod);
|
||||
TrackPoint trackPoint = new TrackPoint(coordinate, currentTimeMilli, expiryPeriod);
|
||||
track.add(trackPoint);
|
||||
|
||||
//Update the nextValidTime for the next track point.
|
||||
nextValidTime = currentTime + trackPointTimeInterval;
|
||||
nextValidTime = currentTimeMilli + trackPointTimeInterval;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public class VisualiserRace extends Race {
|
||||
|
||||
//Attempt to add a track point.
|
||||
if (newBoatStatusEnum == BoatStatusEnum.RACING) {
|
||||
boat.addTrackPoint(boat.getCurrentPosition());
|
||||
boat.addTrackPoint(boat.getCurrentPosition(), raceClock.getCurrentTime());
|
||||
}
|
||||
|
||||
//Set finish time if boat finished.
|
||||
@@ -353,17 +353,21 @@ public class VisualiserRace extends Race {
|
||||
long currentFrameTime = System.currentTimeMillis();
|
||||
long framePeriod = currentFrameTime - lastFrameTime;
|
||||
|
||||
|
||||
//Update race status.
|
||||
updateRaceStatus(latestMessages.getRaceStatus());
|
||||
|
||||
|
||||
//Update racing boats.
|
||||
updateBoats(boats, latestMessages.getBoatLocationMap(), latestMessages.getBoatStatusMap());
|
||||
//And their positions (e.g., 5th).
|
||||
updateBoatPositions(boats);
|
||||
|
||||
|
||||
//Update marker boats.
|
||||
updateMarkers(boatMarkers, latestMessages.getBoatLocationMap(), latestMessages.getBoatStatusMap());
|
||||
|
||||
|
||||
//Update race status.
|
||||
updateRaceStatus(latestMessages.getRaceStatus());
|
||||
|
||||
|
||||
if (getRaceStatusEnum() == RaceStatusEnum.FINISHED) {
|
||||
|
||||
Reference in New Issue
Block a user