Merge branch 'master' into new_issue#19
# Conflicts: # racevisionGame/src/main/java/visualiser/Controllers/TitleController.java
This commit is contained in:
@@ -305,7 +305,6 @@ public class MockRace extends Race {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the distance a boat has travelled and updates its current position according to this value.
|
||||
*
|
||||
@@ -318,7 +317,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) {
|
||||
if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds && boat.isSailsOut()) {
|
||||
|
||||
checkPosition(boat, totalElapsedMilliseconds);
|
||||
|
||||
@@ -344,9 +343,12 @@ public class MockRace extends Race {
|
||||
newOptimalVMG(boat);
|
||||
}
|
||||
|
||||
this.updateEstimatedTime(boat);
|
||||
} else {
|
||||
boat.setCurrentSpeed(0);
|
||||
}
|
||||
|
||||
this.updateEstimatedTime(boat);
|
||||
|
||||
}
|
||||
|
||||
private void newOptimalVMG(MockBoat boat) {
|
||||
@@ -709,4 +711,4 @@ public class MockRace extends Race {
|
||||
public List<CompoundMark> getCompoundMarks() {
|
||||
return compoundMarks;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,4 +199,4 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
|
||||
// else if(e.getBearing().degrees() > 270) System.out.println("Port");
|
||||
// else System.out.println("Behind");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package mock.model.commandFactory;
|
||||
|
||||
import mock.model.MockBoat;
|
||||
import mock.model.MockRace;
|
||||
|
||||
public class SailsCommand implements Command {
|
||||
private MockRace race;
|
||||
private MockBoat boat;
|
||||
private boolean sailsOut;
|
||||
|
||||
public SailsCommand(MockRace race, MockBoat boat, Boolean sailsOut) {
|
||||
this.race = race;
|
||||
this.boat = boat;
|
||||
this.sailsOut = sailsOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
this.boat.setSailsOut(this.sailsOut);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user