fix for boats finishing the race

#story[1101]
main
hba56 8 years ago
parent 2acc36225e
commit 0d786f381b

@ -482,7 +482,14 @@ public class MockRace extends Race {
GPSCoordinate.passesLine(roundingMark.getPosition(), GPSCoordinate.passesLine(roundingMark.getPosition(),
roundingChecks.get(0), boat.getCurrentPosition(), legBearing) && roundingChecks.get(0), boat.getCurrentPosition(), legBearing) &&
gateCheck && boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) { gateCheck && boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) {
System.out.println("0");
boat.increaseRoundingStatus(); boat.increaseRoundingStatus();
System.out.println(boat.getCurrentLeg().getLegNumber());
System.out.println(legs.size());
if (boat.getCurrentLeg().getLegNumber() + 2 >= legs.size()){
//boat has finished race
boat.increaseRoundingStatus();
}
} }
break; break;
case 1://has been parallel to the mark; case 1://has been parallel to the mark;
@ -492,6 +499,7 @@ public class MockRace extends Race {
Bearing.fromDegrees(legBearing.degrees() - 90)) &&//negative 90 from bearing because of port rounding Bearing.fromDegrees(legBearing.degrees() - 90)) &&//negative 90 from bearing because of port rounding
boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(1)))) { boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(1)))) {
boat.increaseRoundingStatus(); boat.increaseRoundingStatus();
System.out.println("1");
} }
break; break;
case 2://has traveled 180 degrees around the mark case 2://has traveled 180 degrees around the mark
@ -499,6 +507,7 @@ public class MockRace extends Race {
boat.resetRoundingStatus(); boat.resetRoundingStatus();
Leg nextLeg = this.legs.get(boat.getCurrentLeg().getLegNumber() + 1); Leg nextLeg = this.legs.get(boat.getCurrentLeg().getLegNumber() + 1);
boat.setCurrentLeg(nextLeg); boat.setCurrentLeg(nextLeg);
System.out.println("2");
break; break;
} }
} }
@ -524,6 +533,10 @@ public class MockRace extends Race {
gateCheck && gateCheck &&
boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) { boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) {
boat.increaseRoundingStatus(); boat.increaseRoundingStatus();
if (boat.getCurrentLeg().getLegNumber() + 2 >= legs.size()){
//boat has finished race
boat.increaseRoundingStatus();
}
} }
break; break;
case 1://has been parallel to the mark case 1://has been parallel to the mark

Loading…
Cancel
Save