Merge branch 'story63' into CommandFactory

# Conflicts:
#	racevisionGame/src/main/java/mock/model/commandFactory/TackGybeCommand.java
This commit is contained in:
zwu18
2017-08-06 14:54:21 +12:00
6 changed files with 38 additions and 11 deletions
@@ -203,4 +203,8 @@ public class MockBoat extends Boat {
public void setAutoVMG(boolean autoVMG) {
this.autoVMG = autoVMG;
}
public boolean getAutoVMG(){
return autoVMG;
}
}
@@ -2,6 +2,7 @@ package mock.model.commandFactory;
import mock.model.MockBoat;
import mock.model.MockRace;
import shared.model.Bearing;
/**
* Created by David on 2/08/2017.
@@ -16,13 +17,6 @@ public class TackGybeCommand implements Command {
}
//The refactoring of MockRace will require changes to be made
private MockBoat boat;
public TackGybeCommand(final MockBoat boat){
this.boat = boat;
}
@Override
public void execute() {
/*VMG newVMG = boat.getPolars().calculateVMG(
@@ -35,7 +29,6 @@ public class TackGybeCommand implements Command {
if(race.improvesVelocity(boatVMG, newVMG, boat.calculateBearingToNextMarker())){
boat.setVMG(newVMG);
}*/
Bearing newBearing = Bearing.fromDegrees(360d - boat.getBearing().degrees());
boat.setBearing(newBearing);
this.boat.setBearing(Bearing.fromDegrees(360 - boat.getBearing().degrees()));
}
}
@@ -25,5 +25,12 @@ public class VMGCommand implements Command {
Bearing.fromDegrees(0d),
Bearing.fromDegrees(359.99999d));
boat.setVMG(newVMG);*/
if (boat.getAutoVMG()){
boat.setAutoVMG(false);
System.out.println("Auto VMG off!");
} else {
boat.setAutoVMG(true);
System.out.println("Auto VMG on!");
}
}
}