Making the course limits change when a new xml packet is received..

#story[889]
This commit is contained in:
Kusal Ekanayake
2017-05-11 15:49:49 +12:00
parent 711f6f4c45
commit 4a75c062ce
4 changed files with 33 additions and 3 deletions
@@ -31,6 +31,7 @@ public class StreamParser extends Thread{
public static ConcurrentHashMap<Long, PriorityBlockingQueue<BoatPositionPacket>> boatPositions = new ConcurrentHashMap<>();
private String threadName;
private Thread t;
private static boolean newXmlRecieved = false;
private static boolean raceStarted = false;
private static XMLParser xmlObject;
private static boolean raceFinished = false;
@@ -122,6 +123,8 @@ public class StreamParser extends Thread{
extractDisplayMessage(packet);
break;
case XML_MESSAGE:
System.out.println("XML MESSAGE GOT");
newXmlRecieved = true;
extractXmlMessage(packet);
break;
case RACE_START_STATUS:
@@ -313,6 +316,9 @@ public class StreamParser extends Thread{
if (messageType == 7) { //7 is the boat XML
boats = xmlObject.getBoatXML().getCompetingBoats();
}
if (messageType == 6) { //6 is race info xml
newXmlRecieved = true;
}
}
/**
@@ -579,5 +585,14 @@ public class StreamParser extends Thread{
appRunning = false;
System.out.println("[CLIENT] Shutting down stream parser");
}
public static boolean isNewXmlRecieved(){
if (newXmlRecieved){
newXmlRecieved = false;
return true;
} else {
return false;
}
}
}