|
|
|
|
@ -42,26 +42,11 @@ public abstract class Race implements Runnable {
|
|
|
|
|
this.legs.add(new Leg("Finish", this.legs.size()));
|
|
|
|
|
this.controller = controller;
|
|
|
|
|
this.scaleFactor = scaleFactor;
|
|
|
|
|
|
|
|
|
|
if (startingBoats != null && startingBoats.size() > 0){
|
|
|
|
|
initialiseBoats();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initialiseBoats() {
|
|
|
|
|
Leg startLeg = legs.get(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (startingBoats.size() > 0) {
|
|
|
|
|
for (BoatInRace boat : startingBoats) {
|
|
|
|
|
if (boat != null) {
|
|
|
|
|
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
|
|
|
|
|
|
|
|
|
boat.setCurrentLeg(startLeg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor for Race class
|
|
|
|
|
*
|
|
|
|
|
@ -83,6 +68,21 @@ public abstract class Race implements Runnable {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initialiseBoats() {
|
|
|
|
|
System.out.println("boat initialisation");
|
|
|
|
|
Leg startLeg = legs.get(0);
|
|
|
|
|
Leg copyLeg = startLeg.createCopy();
|
|
|
|
|
ArrayList<GPSCoordinate> startPositions = getSpreadStartingPositions();
|
|
|
|
|
for (int i = 0; i < startingBoats.size(); i++) {
|
|
|
|
|
BoatInRace boat = startingBoats.get(i);
|
|
|
|
|
if (boat != null) {
|
|
|
|
|
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
|
|
|
|
|
copyLeg.setStartGPSCoordinate(startPositions.get(i));
|
|
|
|
|
boat.setCurrentLeg(startLeg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runnable for the thread.
|
|
|
|
|
*/
|
|
|
|
|
|