Merge remote-tracking branch 'origin/develop' into issue47_disconnect_crash_rebranch

# Conflicts:
#	src/main/java/seng302/gameServer/ServerToClientThread.java
#	src/main/java/seng302/visualiser/controllers/RaceViewController.java
This commit is contained in:
Alistair McIntyre
2017-08-17 14:36:16 +12:00
5 changed files with 26 additions and 15 deletions
@@ -338,7 +338,7 @@ public class ClientToServerThread implements Runnable {
closeSocket();
}
if (currentByte == -1) {
throw new ByteReadException("InputStream reach end of stream");
clientLog("InputStream reach end of stream", 1);
}
return currentByte;
}
@@ -325,6 +325,7 @@ public class GameClient {
raceState.getRaceTime() - roundingData.getTimeStamp()
);
}
updatePlayerPositions();
}
private void processRaceStatusUpdate(RaceStatusData data) {
@@ -341,12 +342,11 @@ public class GameClient {
ClientYacht clientYacht = allBoatsMap.get((int) boatData[0]);
clientYacht.setEstimateTimeTillNextMark(raceState.getRaceTime() - boatData[1]);
clientYacht.setEstimateTimeAtFinish(boatData[2]);
int legNumber = (int) boatData[3];
// int legNumber = (int) boatData[3];
clientYacht.setBoatStatus((int) boatData[4]);
if (legNumber != clientYacht.getLegNumber()) {
clientYacht.setLegNumber(legNumber);
updatePlayerPositions();
}
// if (legNumber != clientYacht.getLegNumber()) {
// clientYacht.setLegNumber(legNumber);
// }
}
if (raceFinished) {
@@ -35,6 +35,7 @@ import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.StringConverter;
import seng302.gameServer.messages.BoatStatus;
import seng302.model.ClientYacht;
import seng302.model.RaceState;
import seng302.model.mark.CompoundMark;
@@ -94,9 +95,10 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
importantAnnotations = new ImportantAnnotationsState();
//Formatting the y axis of the sparkline
raceSparkLine.getYAxis().setRotate(180);
raceSparkLine.getYAxis().setTickLabelRotation(180);
raceSparkLine.getYAxis().setTranslateX(-5);
// raceSparkLine.getYAxis().setRotate(180);
// raceSparkLine.getYAxis().setTickLabelRotation(180);
// raceSparkLine.getYAxis().setTranslateX(-5);
raceSparkLine.visibleProperty().setValue(false);
raceSparkLine.getYAxis().setAutoRanging(false);
sparklineYAxis.setTickMarkVisible(false);
@@ -124,6 +126,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
while (c.next()) {
if (c.wasPermutated()) {
updateOrder(raceState.getPlayerPositions());
updateSparkLine();
}
}
});
@@ -247,14 +250,14 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
// Create a new data series for new yachts
sparkLineCandidates
.stream()
.filter(yacht -> yacht.getPlacing() != null)
.filter(yacht -> yacht.getPosition() != null)
.forEach(yacht -> {
Series<String, Double> yachtData = new Series<>();
yachtData.setName(yacht.getSourceId().toString());
yachtData.getData().add(
new XYChart.Data<>(
new Data<>(
Integer.toString(yacht.getLegNumber()),
1.0 + participants.size() - yacht.getPlacing()
1.0 + participants.size() - yacht.getPosition()
)
);
sparkLineData.add(yachtData);
@@ -270,6 +273,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
return -1;
}
});
// Adds the new data series to the sparkline (and set the colour of the series)
Platform.runLater(() -> {
sparkLineData
@@ -410,7 +414,9 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
List<Text> vboxEntries = new ArrayList<>();
for (int i = 0; i < yachts.size(); i++) {
if (yachts.get(i).getBoatStatus() == 3) { // 3 is finish status
// System.out.println("yacht == null " + String.valueOf(yacht == null));
if (yachts.get(i).getBoatStatus() == BoatStatus.FINISHED
.getCode()) { // 3 is finish status
Text textToAdd = new Text(i + 1 + ". " +
yachts.get(i).getShortName() + " (Finished)");
textToAdd.setFill(Paint.valueOf("#d3d3d3"));