Fixed first key press not working. #story[1098]
This commit is contained in:
@@ -319,12 +319,7 @@ public class MockRace extends Race {
|
|||||||
//Checks if the current boat has finished the race or not.
|
//Checks if the current boat has finished the race or not.
|
||||||
boolean finish = this.isLastLeg(boat.getCurrentLeg());
|
boolean finish = this.isLastLeg(boat.getCurrentLeg());
|
||||||
|
|
||||||
if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds && boat.isSailsOut()) {
|
if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds & boat.isSailsOut()) {
|
||||||
|
|
||||||
// if (boat.getCurrentSpeed() == 0) {
|
|
||||||
// newOptimalVMG(boat);
|
|
||||||
// boat.setBearing(boat.calculateBearingToNextMarker());
|
|
||||||
// }
|
|
||||||
|
|
||||||
setBoatSpeed(boat);
|
setBoatSpeed(boat);
|
||||||
|
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ public class RaceController extends Controller {
|
|||||||
ControlKey controlKey = keyFactory.getKey(codeString);
|
ControlKey controlKey = keyFactory.getKey(codeString);
|
||||||
if(controlKey != null) {
|
if(controlKey != null) {
|
||||||
try {
|
try {
|
||||||
controllerClient.sendKey(controlKey);
|
|
||||||
controlKey.onAction(); // Change key state if applicable
|
controlKey.onAction(); // Change key state if applicable
|
||||||
|
controllerClient.sendKey(controlKey);
|
||||||
event.consume();
|
event.consume();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ public class ControllerServer extends Observable implements Runnable {
|
|||||||
action = boatActionDecoder.getBoatAction();
|
action = boatActionDecoder.getBoatAction();
|
||||||
|
|
||||||
// Notify observers of most recent action
|
// Notify observers of most recent action
|
||||||
this.notifyObservers();
|
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
|
this.notifyObservers();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class SailsToggleKey extends ControlKey {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public SailsToggleKey(String name) {
|
public SailsToggleKey(String name) {
|
||||||
super(name, BoatActionEnum.SAILS_IN);
|
super(name, BoatActionEnum.NOT_A_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user