diff --git a/racevisionGame/src/main/java/mock/app/Event.java b/racevisionGame/src/main/java/mock/app/Event.java index f0783fc0..6246d699 100644 --- a/racevisionGame/src/main/java/mock/app/Event.java +++ b/racevisionGame/src/main/java/mock/app/Event.java @@ -72,8 +72,6 @@ public class Event { */ public Event(boolean singlePlayer) throws EventConstructionException { - singlePlayer = false;//TEMP - String raceXMLFile = "mock/mockXML/raceTest.xml"; String boatsXMLFile = "mock/mockXML/boatTest.xml"; String regattaXMLFile = "mock/mockXML/regattaTest.xml"; diff --git a/racevisionGame/src/main/java/mock/model/MockRace.java b/racevisionGame/src/main/java/mock/model/MockRace.java index 84e33daf..3970f5d0 100644 --- a/racevisionGame/src/main/java/mock/model/MockRace.java +++ b/racevisionGame/src/main/java/mock/model/MockRace.java @@ -341,7 +341,7 @@ public class MockRace extends Race { this.updateEstimatedTime(boat); } - checkPosition(boat, totalElapsedMilliseconds); + } private void newOptimalVMG(MockBoat boat) { diff --git a/racevisionGame/src/main/java/shared/dataInput/RaceXMLReader.java b/racevisionGame/src/main/java/shared/dataInput/RaceXMLReader.java index 135cd988..02e1afc6 100644 --- a/racevisionGame/src/main/java/shared/dataInput/RaceXMLReader.java +++ b/racevisionGame/src/main/java/shared/dataInput/RaceXMLReader.java @@ -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); diff --git a/racevisionGame/src/main/java/shared/model/Boat.java b/racevisionGame/src/main/java/shared/model/Boat.java index d6e28783..385c4f3b 100644 --- a/racevisionGame/src/main/java/shared/model/Boat.java +++ b/racevisionGame/src/main/java/shared/model/Boat.java @@ -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; } diff --git a/racevisionGame/src/main/java/shared/model/Race.java b/racevisionGame/src/main/java/shared/model/Race.java index 1a366bfb..b8902d84 100644 --- a/racevisionGame/src/main/java/shared/model/Race.java +++ b/racevisionGame/src/main/java/shared/model/Race.java @@ -342,13 +342,7 @@ public abstract class Race { return lastFps; } - /** - * Returns the legs of this race - * @return list of legs - */ - public List getLegs() { - return legs; - } + /** * Increments the FPS counter, and adds timePeriod milliseconds to our FPS reset timer. diff --git a/racevisionGame/src/main/java/visualiser/Controllers/HostController.java b/racevisionGame/src/main/java/visualiser/Controllers/HostController.java index 3360e514..5966c643 100644 --- a/racevisionGame/src/main/java/visualiser/Controllers/HostController.java +++ b/racevisionGame/src/main/java/visualiser/Controllers/HostController.java @@ -47,7 +47,7 @@ public class HostController extends Controller { */ public void hostGamePressed() throws IOException{ try { - Event game = new Event(true); + Event game = new Event(false); game.start(); connectSocket("localhost", 4942); } catch (EventConstructionException e) { diff --git a/racevisionGame/src/main/java/visualiser/model/ResizableRaceCanvas.java b/racevisionGame/src/main/java/visualiser/model/ResizableRaceCanvas.java index b141eb63..d06ef6f4 100644 --- a/racevisionGame/src/main/java/visualiser/model/ResizableRaceCanvas.java +++ b/racevisionGame/src/main/java/visualiser/model/ResizableRaceCanvas.java @@ -317,39 +317,35 @@ public class ResizableRaceCanvas extends ResizableCanvas { */ private void drawBoat(VisualiserBoat boat) { - //The position may be null if we haven't received any BoatLocation messages yet. - if (boat.getCurrentPosition() != null) { - - if (boat.isClientBoat()) { - drawClientBoat(boat); - } + if (boat.isClientBoat()) { + drawClientBoat(boat); + } - //Convert position to graph coordinate. - GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition()); + //Convert position to graph coordinate. + GraphCoordinate pos = this.map.convertGPS(boat.getCurrentPosition()); - //The x coordinates of each vertex of the boat. - double[] x = { - pos.getX() - 6, - pos.getX(), - pos.getX() + 6 }; + //The x coordinates of each vertex of the boat. + double[] x = { + pos.getX() - 6, + pos.getX(), + pos.getX() + 6 }; - //The y coordinates of each vertex of the boat. - double[] y = { - pos.getY() + 12, - pos.getY() - 12, - pos.getY() + 12 }; + //The y coordinates of each vertex of the boat. + double[] y = { + pos.getY() + 12, + pos.getY() - 12, + pos.getY() + 12 }; - //The above shape is essentially a triangle 12px wide, and 24px long. + //The above shape is essentially a triangle 12px wide, and 24px long. - //Draw the boat. - gc.setFill(boat.getColor()); + //Draw the boat. + gc.setFill(boat.getColor()); - gc.save(); - rotate(boat.getBearing().degrees(), pos.getX(), pos.getY()); - gc.fillPolygon(x, y, 3); - gc.restore(); + gc.save(); + rotate(boat.getBearing().degrees(), pos.getX(), pos.getY()); + gc.fillPolygon(x, y, 3); + gc.restore(); - } } @@ -521,7 +517,7 @@ public class ResizableRaceCanvas extends ResizableCanvas { * draws a transparent line around the course that shows the paths boats must travel */ public void drawRaceLine(){ - List legs = this.visualiserRace.getLegs(); + List legs = this.visualiserRace.getVisualiserRaceState().getLegs(); GPSCoordinate legStartPoint = legs.get(0).getStartCompoundMark().getAverageGPSCoordinate(); GPSCoordinate nextStartPoint; for (int i = 0; i < legs.size() -1; i++) { diff --git a/racevisionGame/src/main/resources/mock/mockXML/raceSinglePlayer.xml b/racevisionGame/src/main/resources/mock/mockXML/raceSinglePlayer.xml index a5d6761f..553c2571 100644 --- a/racevisionGame/src/main/resources/mock/mockXML/raceSinglePlayer.xml +++ b/racevisionGame/src/main/resources/mock/mockXML/raceSinglePlayer.xml @@ -8,12 +8,12 @@ - - - - - - + + + + + +