Fix lobby not entering race when race status is "started".

-Race was previously stuck in lobby screen when race status was not 2.

#Story[782]
main
David Wu 9 years ago
parent e345f08ad8
commit 545ef7aa7f

@ -111,8 +111,8 @@ public class Race implements Runnable {
AnimationTimer timer = new AnimationTimer() { AnimationTimer timer = new AnimationTimer() {
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
long startTime = currentTime + (PRERACE_TIME / scaleFactor); long startTime = currentTime + (PRERACE_TIME / scaleFactor);
long minutes; //long minutes;
long hours; //long hours;
long timeLeft; long timeLeft;
@Override @Override

@ -93,6 +93,4 @@ public class BoatTest {
TEST_BOAT.setCurrentLeg(start); TEST_BOAT.setCurrentLeg(start);
assertEquals(TEST_BOAT.calculateHeading(), 270, 1e-8); assertEquals(TEST_BOAT.calculateHeading(), 270, 1e-8);
} }
} }

@ -40,6 +40,7 @@ public class StartController extends Controller implements Observer {
@FXML private TableColumn<Boat, String> boatCodeColumn; @FXML private TableColumn<Boat, String> boatCodeColumn;
@FXML private Label timeZoneTime; @FXML private Label timeZoneTime;
@FXML private Label timer; @FXML private Label timer;
@FXML private Label raceStatusLabel;
@FXML private int PRERACE_TIME = 10; @FXML private int PRERACE_TIME = 10;
//@FXML Button fifteenMinButton; //@FXML Button fifteenMinButton;
@ -48,6 +49,7 @@ public class StartController extends Controller implements Observer {
private StreamedCourse raceData; private StreamedCourse raceData;
private long timeLeft = 1; private long timeLeft = 1;
private int raceStat;
private VisualiserInput visualiserInput; private VisualiserInput visualiserInput;
@ -107,7 +109,9 @@ public class StartController extends Controller implements Observer {
@Override @Override
public void handle(long arg0) { public void handle(long arg0) {
timeLeft = startTime - currentTime; timeLeft = startTime - currentTime;
if (visualiserInput.getRaceStatus().getRaceStatus()==2) { raceStat = visualiserInput.getRaceStatus().getRaceStatus();
raceStatusLabel.setText("Race Status: " + visualiserInput.getRaceStatus().getRaceStatus());
if (raceStat==2 || raceStat == 3) {
updateTime("Race is starting..."); updateTime("Race is starting...");
stop(); stop();
parent.beginRace(visualiserInput); parent.beginRace(visualiserInput);

@ -50,6 +50,7 @@
<Font size="36.0" /> <Font size="36.0" />
</font> </font>
</Label> </Label>
<Label fx:id="raceStatusLabel" alignment="CENTER" text="Race Status:" textAlignment="CENTER" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
</children> </children>
</GridPane> </GridPane>
</children> </children>

Loading…
Cancel
Save