diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 12dfecd9..00000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index ab182112..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - $USER_HOME$/.subversion - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 09c81627..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/main/java/seng302/Model/BoatInRace.java b/src/main/java/seng302/Model/BoatInRace.java index a224b5e2..200a2fff 100644 --- a/src/main/java/seng302/Model/BoatInRace.java +++ b/src/main/java/seng302/Model/BoatInRace.java @@ -17,6 +17,7 @@ public class BoatInRace extends Boat { private GPSCoordinate currentPosition; private long timeFinished; private Color colour; + private boolean finished = false; /** * @@ -112,6 +113,14 @@ public class BoatInRace extends Boat { this.distanceTravelledInLeg = distanceTravelledInLeg; } + public boolean isFinished() { + return this.finished; + } + + public void setFinished(boolean bool) { + this.finished = bool; + } + /** * Calculates the bearing of the travel via map coordinates of the raceMarkers diff --git a/src/main/java/seng302/Model/Race.java b/src/main/java/seng302/Model/Race.java index d840ffd8..47343dfb 100644 --- a/src/main/java/seng302/Model/Race.java +++ b/src/main/java/seng302/Model/Race.java @@ -110,7 +110,7 @@ public abstract class Race implements Runnable { for (BoatInRace boat : startingBoats) { - if (boat != null) { + if (boat != null && !boat.isFinished()) { updatePosition(boat, SLEEP_TIME); checkPosition(boat, totalTimeElapsed); } @@ -139,8 +139,8 @@ public abstract class Race implements Runnable { //boat has passed onto new leg if (boat.getCurrentLeg().getName().equals("Finish")) { //boat has finished - boat.setTimeFinished(timeElapsed); boatsFinished++; + boat.setFinished(true); } else { boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg() - boat.getCurrentLeg().getDistance()); Leg nextLeg = legs.get(boat.getCurrentLeg().getLegNumber() + 1); diff --git a/src/main/java/seng302/Model/ResizableRaceCanvas.java b/src/main/java/seng302/Model/ResizableRaceCanvas.java index c5bce448..9cbd403f 100644 --- a/src/main/java/seng302/Model/ResizableRaceCanvas.java +++ b/src/main/java/seng302/Model/ResizableRaceCanvas.java @@ -164,7 +164,7 @@ public class ResizableRaceCanvas extends Canvas { if (boats != null) { for (BoatInRace boat : boats) { if (boat != null) { - System.out.print("Drawing Boat At: " + boat.getCurrentPosition()); +// System.out.print("Drawing Boat At: " + boat.getCurrentPosition()); displayMark(this.map.convertGPS(boat.getCurrentPosition()), boat.getColour()); } } @@ -183,7 +183,7 @@ public class ResizableRaceCanvas extends Canvas { */ public void drawBoat(Color colour, GPSCoordinate gpsCoordinates) { GraphCoordinate graphCoordinate = this.map.convertGPS(gpsCoordinates); - System.out.println("DrawingBoat" + gpsCoordinates.getLongitude()); + //System.out.println("DrawingBoat" + gpsCoordinates.getLongitude()); displayPoint(graphCoordinate, colour); }