Fixed merge issue
- Strange Issue where there was a null pointer from convertGPS however it has resolved itself may crop in the future htough. #story[782]
This commit is contained in:
@@ -164,8 +164,7 @@ public class StreamedCourseXMLReader extends XMLReader {
|
||||
* @return value of "compoundMarkID" attribute
|
||||
*/
|
||||
private int getCompoundMarkID(Element element) {
|
||||
//return Integer.parseInt(element.getAttribute("CompoundMarkID"));
|
||||
return 3;
|
||||
return Integer.parseInt(element.getAttribute("CompoundMarkID"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,10 +183,11 @@ public class StreamedCourseXMLReader extends XMLReader {
|
||||
private void readCompoundMarkSequence() throws StreamedCourseXMLException {
|
||||
Element nCompoundMarkSequence = (Element) doc.getElementsByTagName("CompoundMarkSequence").item(0);
|
||||
NodeList nCorners = nCompoundMarkSequence.getElementsByTagName("Corner");
|
||||
Marker lastMarker = getMarker(getCompoundMarkID((Element)nCorners.item(0)));
|
||||
String legName = getCompoundMarkName(getCompoundMarkID((Element)nCorners.item(0)));
|
||||
Element markXML = (Element)nCorners.item(0);
|
||||
Marker lastMarker = getMarker(getCompoundMarkID(markXML));
|
||||
String legName = getCompoundMarkName(getCompoundMarkID(markXML));
|
||||
for(int i = 1; i < nCorners.getLength(); i++) {
|
||||
Element markXML = (Element)nCorners.item(i);
|
||||
markXML = (Element)nCorners.item(i);
|
||||
Marker currentMarker = getMarker(getCompoundMarkID(markXML));
|
||||
legs.add(new Leg(legName, lastMarker, currentMarker, i-1));
|
||||
lastMarker = currentMarker;
|
||||
|
||||
@@ -6,6 +6,9 @@ import seng302.*;
|
||||
import seng302.Controllers.RaceController;
|
||||
import seng302.Model.*;
|
||||
import seng302.Networking.MessageDecoders.BoatLocationDecoder;
|
||||
import seng302.Networking.Utils.BoatStatusMessage;
|
||||
import seng302.Networking.Utils.ByteConverter;
|
||||
import seng302.Networking.Utils.Enums.BoatStatus;
|
||||
import seng302.Networking.Utils.BoatLocationMessage;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
@@ -48,18 +51,26 @@ public class StreamedRace extends Race {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the position of the boat, this updates the boats current position.
|
||||
* Checks the position of the boat.
|
||||
*
|
||||
* @param boat Boat that the position is to be updated for.
|
||||
* @param timeElapsed Time that has elapse since the start of the the race.
|
||||
* @see BoatInRace
|
||||
*/
|
||||
protected void checkPosition(Boat boat, long timeElapsed) {
|
||||
if (boat.getCurrentLeg().getName().toLowerCase().contains("finish")) {
|
||||
//boat has finished
|
||||
StreamedCourse raceData = visualiserInput.getCourse();
|
||||
BoatStatusMessage boatStatusMessage = visualiserInput.getBoatStatus().get(boat.getSourceID());
|
||||
BoatStatus boatStatus = BoatStatus.valueOf(boatStatusMessage.getBoatStatus());
|
||||
int legNumber = boatStatusMessage.getLegNumber();
|
||||
|
||||
if (boatStatus == BoatStatus.DNF) {
|
||||
boat.setDnf(true);
|
||||
} else if (boatStatus == BoatStatus.FINISHED || legNumber > raceData.getLegs().size()) {
|
||||
boatsFinished++;
|
||||
boat.setFinished(true);
|
||||
boat.setTimeFinished(timeElapsed);
|
||||
boat.setFinished(true);
|
||||
} else {
|
||||
boat.setCurrentLeg(raceData.getLegs().get(legNumber));
|
||||
}
|
||||
//Update the boat display table in the GUI to reflect the leg change
|
||||
updatePositions();
|
||||
|
||||
Reference in New Issue
Block a user