|
|
|
|
@ -19,8 +19,10 @@ import javax.xml.transform.TransformerException;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
import java.time.ZonedDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
|
|
|
|
|
@ -70,7 +72,7 @@ public class Event {
|
|
|
|
|
*/
|
|
|
|
|
public Event(boolean singlePlayer) throws EventConstructionException {
|
|
|
|
|
|
|
|
|
|
singlePlayer = false;
|
|
|
|
|
singlePlayer = false;//TEMP
|
|
|
|
|
|
|
|
|
|
String raceXMLFile = "mock/mockXML/raceTest.xml";
|
|
|
|
|
String boatsXMLFile = "mock/mockXML/boatTest.xml";
|
|
|
|
|
@ -154,14 +156,6 @@ public class Event {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getAddress() throws UnknownHostException {
|
|
|
|
|
return connectionAcceptor.getAddress();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getPort() {
|
|
|
|
|
return connectionAcceptor.getServerPort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends the initial race data and then begins race simulation.
|
|
|
|
|
*/
|
|
|
|
|
@ -190,7 +184,7 @@ public class Event {
|
|
|
|
|
private String getRaceXMLAtCurrentTime(String raceXML) {
|
|
|
|
|
|
|
|
|
|
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
|
|
|
|
|
long millisecondsToAdd = Constants.RacePreStartTime + (1 * 60 * 1000);
|
|
|
|
|
long millisecondsToAdd = Constants.RacePreStartTime + Duration.ofMinutes(1).toMillis();
|
|
|
|
|
long secondsToAdd = millisecondsToAdd / 1000;
|
|
|
|
|
//Scale the time using our time scalar.
|
|
|
|
|
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
|
|
|
|
|
|