|
|
|
@ -40,24 +40,17 @@ public class Event {
|
|
|
|
private String raceXML;
|
|
|
|
private String raceXML;
|
|
|
|
private String regattaXML;
|
|
|
|
private String regattaXML;
|
|
|
|
private String boatXML;
|
|
|
|
private String boatXML;
|
|
|
|
|
|
|
|
|
|
|
|
private XMLFileType xmlFileType;
|
|
|
|
private XMLFileType xmlFileType;
|
|
|
|
|
|
|
|
|
|
|
|
private Polars boatPolars;
|
|
|
|
private Polars boatPolars;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Data sources containing data from the xml files.
|
|
|
|
* Data sources containing data from the xml files.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
RaceDataSource raceDataSource;
|
|
|
|
private RaceDataSource raceDataSource;
|
|
|
|
BoatDataSource boatDataSource;
|
|
|
|
private BoatDataSource boatDataSource;
|
|
|
|
RegattaDataSource regattaDataSource;
|
|
|
|
private RegattaDataSource regattaDataSource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ConnectionAcceptor connectionAcceptor;
|
|
|
|
private ConnectionAcceptor connectionAcceptor;
|
|
|
|
private LatestMessages latestMessages;
|
|
|
|
private LatestMessages latestMessages;
|
|
|
|
|
|
|
|
|
|
|
|
private CompositeCommand compositeCommand;
|
|
|
|
private CompositeCommand compositeCommand;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This is used to allocate source IDs.
|
|
|
|
* This is used to allocate source IDs.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -66,22 +59,17 @@ public class Event {
|
|
|
|
private RaceLogic raceLogic;
|
|
|
|
private RaceLogic raceLogic;
|
|
|
|
|
|
|
|
|
|
|
|
private Thread raceThread;
|
|
|
|
private Thread raceThread;
|
|
|
|
|
|
|
|
|
|
|
|
private Thread connectionThread;
|
|
|
|
private Thread connectionThread;
|
|
|
|
|
|
|
|
|
|
|
|
private int mapIndex;
|
|
|
|
private int mapIndex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Constructs an event, using various XML files.
|
|
|
|
* Constructs an event, using various XML files.
|
|
|
|
* @param singlePlayer Whether or not to create a single player event.
|
|
|
|
* @param singlePlayer Whether or not to create a single player event.
|
|
|
|
* @param mapIndex Specifies which map to use.
|
|
|
|
* @param mapIndex Specifies which map to use.
|
|
|
|
* @throws EventConstructionException Thrown if we cannot create an Event for any reason.
|
|
|
|
* @throws EventConstructionException Thrown if we cannot create an Event for any reason.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Event(boolean singlePlayer, int mapIndex) throws EventConstructionException {
|
|
|
|
public Event(boolean singlePlayer, int mapIndex, int raceLength) throws
|
|
|
|
|
|
|
|
EventConstructionException {
|
|
|
|
PolarParser.parseNewPolars("mock/polars/acc_polars.csv");
|
|
|
|
PolarParser.parseNewPolars("mock/polars/acc_polars.csv");
|
|
|
|
this.mapIndex = mapIndex;
|
|
|
|
this.mapIndex = mapIndex;
|
|
|
|
String raceXMLFile;
|
|
|
|
String raceXMLFile;
|
|
|
|
@ -125,8 +113,8 @@ public class Event {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8));
|
|
|
|
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8));
|
|
|
|
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, windAngle);
|
|
|
|
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, windAngle);
|
|
|
|
this.raceXML = RaceXMLCreator.scaleRaceSize(raceXML, windSpeed, 15 * 60 * 1000);
|
|
|
|
this.raceXML = RaceXMLCreator.scaleRaceSize(raceXML,
|
|
|
|
|
|
|
|
windSpeed, raceLength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
|
|
|
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
|
|
|
|