Fixed first key press not working. #story[1098]

main
Joseph Gardner 9 years ago
parent 0558629dc6
commit 7d4f1cd925

@ -319,12 +319,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 && boat.isSailsOut()) {
// if (boat.getCurrentSpeed() == 0) {
// newOptimalVMG(boat);
// boat.setBearing(boat.calculateBearingToNextMarker());
// }
if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds & boat.isSailsOut()) {
setBoatSpeed(boat);

@ -111,8 +111,8 @@ public class RaceController extends Controller {
ControlKey controlKey = keyFactory.getKey(codeString);
if(controlKey != null) {
try {
controllerClient.sendKey(controlKey);
controlKey.onAction(); // Change key state if applicable
controllerClient.sendKey(controlKey);
event.consume();
} catch (IOException e) {
e.printStackTrace();

@ -67,8 +67,8 @@ public class ControllerServer extends Observable implements Runnable {
action = boatActionDecoder.getBoatAction();
// Notify observers of most recent action
this.notifyObservers();
this.setChanged();
this.notifyObservers();
}
} catch (IOException e) {
e.printStackTrace();

@ -14,7 +14,7 @@ public class SailsToggleKey extends ControlKey {
*
*/
public SailsToggleKey(String name) {
super(name, BoatActionEnum.SAILS_IN);
super(name, BoatActionEnum.NOT_A_STATUS);
}
/**

Loading…
Cancel
Save