Tests for race clock being scaled correctly added

#story[16] #test
This commit is contained in:
Erika Savell
2017-03-24 11:57:54 +13:00
parent 944da81946
commit d23a80841a
2 changed files with 36 additions and 14 deletions
+7 -3
View File
@@ -20,7 +20,7 @@ public abstract class Race implements Runnable {
protected int boatsFinished = 0;
protected long totalTimeElapsed;
protected int scaleFactor = 1;
protected int scaleFactor = 15;
private int SLEEP_TIME = 100; //time in milliseconds to pause in a paced loop
protected int PRERACE_TIME = 10000;//Integer.MAX_VALUE; //time in milliseconds to pause during pre-race
@@ -52,8 +52,12 @@ public abstract class Race implements Runnable {
}
public Race(BoatInRace[] boats, ArrayList<Leg> legs, int scaleFactor) {
for (BoatInRace boat : boats) {
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
if (boats.length > 0) {
for (BoatInRace boat : boats) {
if (boat != null) {
boat.setScaledVelocity(boat.getVelocity() * scaleFactor);
}
}
}
this.startingBoats = FXCollections.observableArrayList(boats);
this.legs = legs;