Merged master.

This commit is contained in:
Joseph
2017-08-17 09:27:41 +12:00
parent f60809bdd4
commit 47fc55245c
5 changed files with 19 additions and 21 deletions
@@ -313,14 +313,7 @@ public class MockRace extends Race {
//Checks if the current boat has finished the race or not.
boolean finish = this.isLastLeg(boat.getCurrentLeg());
if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds) {
checkPosition(boat, totalElapsedMilliseconds);
if (boat.getCurrentSpeed() == 0) {
newOptimalVMG(boat);
boat.setBearing(boat.calculateBearingToNextMarker());
}
if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds & boat.isSailsOut()) {
setBoatSpeed(boat);
@@ -339,9 +332,12 @@ public class MockRace extends Race {
newOptimalVMG(boat);
}
this.updateEstimatedTime(boat);
} else {
boat.setCurrentSpeed(0);
}
this.updateEstimatedTime(boat);
}
private void newOptimalVMG(MockBoat boat) {
@@ -33,6 +33,8 @@ public class CommandFactory {
case TACK_GYBE: return new TackGybeCommand(race, boat);
case UPWIND: return new WindCommand(race, boat, true);
case DOWNWIND: return new WindCommand(race, boat, false);
case SAILS_OUT: return new SailsCommand(race, boat, true);
case SAILS_IN: return new SailsCommand(race, boat, false);
default: throw new CommandConstructionException("Could not create command for BoatAction: " + action + ". Unknown BoatAction.");
}