mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added a dynamically updating course limits file to the model.
This will make manual testing of the course limits easier. When the race starts, the limits encapsulate the start line but soon after the race starts the course limits close off around the start line (this is for the model). This means the model acts in a very similar way to the actual live stream. #story[889]
This commit is contained in:
@@ -235,6 +235,27 @@ public class ServerThread implements Runnable, Observer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the post-start race course information
|
||||
*/
|
||||
private void sendPostStartCourseXml(){
|
||||
Timer t = new Timer();
|
||||
t.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Message raceData = getXmlMessage("/server_config/courseLimits.xml", XMLMessageSubType.RACE);
|
||||
if (raceData != null) {
|
||||
server.send(raceData);
|
||||
serverLog("Sending race data", 0);
|
||||
}
|
||||
}catch (IOException e) {
|
||||
serverLog("Couldn't send an XML Message: " + e.getMessage(), 0);
|
||||
}
|
||||
}
|
||||
},25000);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try{
|
||||
server = new StreamingServerSocket(PORT_NUMBER);
|
||||
@@ -252,12 +273,13 @@ public class ServerThread implements Runnable, Observer {
|
||||
sendXml();
|
||||
startSendingRaceStartStatusMessages();
|
||||
startSendingRaceStatusMessages();
|
||||
sendPostStartCourseXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start sending static boat position updates when race has finished
|
||||
*/
|
||||
private void startSendingRaceFinishedBoatPostions(){
|
||||
private void startSendingRaceFinishedBoatPositions(){
|
||||
Timer t = new Timer();
|
||||
t.schedule(new TimerTask() {
|
||||
@Override
|
||||
@@ -316,7 +338,7 @@ public class ServerThread implements Runnable, Observer {
|
||||
}
|
||||
|
||||
if (numOfBoatsFinished == ((List<Boat>) arg).size()) {
|
||||
startSendingRaceFinishedBoatPostions();
|
||||
startSendingRaceFinishedBoatPositions();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user