Removed build-breaking code from MockRace
#story[1096]
This commit is contained in:
@@ -575,13 +575,6 @@ public class MockRace extends Race {
|
|||||||
boat.setCurrentSpeed(0);
|
boat.setCurrentSpeed(0);
|
||||||
boat.setStatus(BoatStatusEnum.FINISHED);
|
boat.setStatus(BoatStatusEnum.FINISHED);
|
||||||
|
|
||||||
} else if (doNotFinish()) {
|
|
||||||
//Boat has pulled out of race.
|
|
||||||
boat.setTimeFinished(timeElapsed);
|
|
||||||
boat.setCurrentLeg(new Leg("DNF", -1));
|
|
||||||
boat.setCurrentSpeed(0);
|
|
||||||
boat.setStatus(BoatStatusEnum.DNF);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -589,82 +582,6 @@ public class MockRace extends Race {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//old method fo checking if boats passed a mark
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Checks if a boat has finished any legs, or has pulled out of race (DNF).
|
|
||||||
// * @param boat The boat to check.
|
|
||||||
// * @param timeElapsed The total time, in milliseconds, that has elapsed since the race started.
|
|
||||||
// */
|
|
||||||
// protected void checkPosition(MockBoat boat, long timeElapsed) {
|
|
||||||
//
|
|
||||||
// //The distance, in nautical miles, within which the boat needs to get in order to consider that it has reached the marker.
|
|
||||||
// double epsilonNauticalMiles = 100.0 / Constants.NMToMetersConversion; //100 meters. TODO should be more like 5-10.
|
|
||||||
//
|
|
||||||
// if (boat.calculateDistanceToNextMarker() < epsilonNauticalMiles) {
|
|
||||||
// //Boat has reached its target marker, and has moved on to a new leg.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //Calculate how much the boat overshot the marker by.
|
|
||||||
// double overshootMeters = boat.calculateDistanceToNextMarker();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //Move boat on to next leg.
|
|
||||||
// Leg nextLeg = this.legs.get(boat.getCurrentLeg().getLegNumber() + 1);
|
|
||||||
// boat.setCurrentLeg(nextLeg);
|
|
||||||
//
|
|
||||||
// //Add overshoot distance into the distance travelled for the next leg.
|
|
||||||
// boat.setDistanceTravelledInLeg(overshootMeters);
|
|
||||||
//
|
|
||||||
// //Setting a high value for this allows the boat to immediately do a large turn, as it needs to in order to get to the next mark.
|
|
||||||
// boat.setTimeSinceTackChange(999999);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //Check if the boat has finished or stopped racing.
|
|
||||||
//
|
|
||||||
// if (this.isLastLeg(boat.getCurrentLeg())) {
|
|
||||||
// //Boat has finished.
|
|
||||||
// boat.setTimeFinished(timeElapsed);
|
|
||||||
// boat.setCurrentSpeed(0);
|
|
||||||
// boat.setStatus(BoatStatusEnum.FINISHED);
|
|
||||||
//
|
|
||||||
// } else if (doNotFinish()) {
|
|
||||||
// //Boat has pulled out of race.
|
|
||||||
// boat.setTimeFinished(timeElapsed);
|
|
||||||
// boat.setCurrentLeg(new Leg("DNF", -1));
|
|
||||||
// boat.setCurrentSpeed(0);
|
|
||||||
// boat.setStatus(BoatStatusEnum.DNF);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the chance each boat has of failing at a gate or marker
|
|
||||||
*
|
|
||||||
* @param chance percentage chance a boat has of failing per checkpoint.
|
|
||||||
*/
|
|
||||||
protected void setDnfChance(int chance) {
|
|
||||||
if (chance >= 0 && chance <= 100) {
|
|
||||||
dnfChance = chance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decides if a boat should received a DNF status.
|
|
||||||
* @return True means it should DNF, false means it shouldn't.
|
|
||||||
*/
|
|
||||||
protected boolean doNotFinish() {
|
|
||||||
Random rand = new Random();
|
|
||||||
return rand.nextInt(100) < dnfChance;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user