Fixed null pointer exception when a boat finishes the race.

Boats now default to have position (0, 0).
Added mark rounding data to single player race.xml
This commit is contained in:
fjc40
2017-08-15 17:13:12 +12:00
parent 3a0bd10a57
commit 5ae8393126
8 changed files with 43 additions and 51 deletions
@@ -363,7 +363,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
CompoundMark currentCompoundMark = this.compoundMarkMap.get(cornerID);
//Sets the rounding type of this compound mark
currentCompoundMark.setRoundingType(RoundingType.valueOf(cornerRounding));
currentCompoundMark.setRoundingType(RoundingType.getValueOf(cornerRounding));
//Create a leg from these two adjacent compound marks.
Leg leg = new Leg(legName, lastCompoundMark, currentCompoundMark, i - 1);
@@ -82,6 +82,7 @@ public class Boat {
/**
* The time at which the boat is estimated to reach the next mark, in milliseconds since unix epoch.
*/
@Nullable
private ZonedDateTime estimatedTimeAtNextMark;
/**
@@ -106,6 +107,8 @@ public class Boat {
this.bearing = Bearing.fromDegrees(0d);
setCurrentPosition(new GPSCoordinate(0, 0));
this.status = BoatStatusEnum.UNDEFINED;
}
@@ -365,6 +368,7 @@ public class Boat {
* Returns the time at which the boat should reach the next mark.
* @return Time at which the boat should reach next mark.
*/
@Nullable
public ZonedDateTime getEstimatedTimeAtNextMark() {
return estimatedTimeAtNextMark;
}
@@ -342,13 +342,7 @@ public abstract class Race {
return lastFps;
}
/**
* Returns the legs of this race
* @return list of legs
*/
public List<Leg> getLegs() {
return legs;
}
/**
* Increments the FPS counter, and adds timePeriod milliseconds to our FPS reset timer.