@ -40,46 +40,33 @@ 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 .
* /
* /
private SourceIdAllocator sourceIdAllocator ;
private SourceIdAllocator sourceIdAllocator ;
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 ;
@ -121,7 +108,9 @@ public class Event {
this . raceXML = RaceXMLCreator . alterRaceToWind ( this . raceXML , XMLFileType . Contents , - 1 , true ) ;
this . raceXML = RaceXMLCreator . alterRaceToWind ( this . raceXML , XMLFileType . Contents , - 1 , true ) ;
} else {
} else {
this . raceXML = RaceXMLCreator . alterRaceToWind ( this . raceXML , XMLFileType . Contents , windAngle , false ) ;
this . raceXML = RaceXMLCreator . alterRaceToWind ( this . raceXML , XMLFileType . Contents , windAngle , false ) ;
this . raceXML = RaceXMLCreator . scaleRaceSize ( raceXML , windSpeed , 15 * 60 * 1000 ) ;
this . raceXML = RaceXMLCreator . scaleRaceSize ( raceXML ,
windSpeed , raceLength ) ;
System . out . println ( raceLength ) ;
}
}
this . boatXML = XMLReader . readXMLFileToString ( boatsXMLFile , StandardCharsets . UTF_8 ) ;
this . boatXML = XMLReader . readXMLFileToString ( boatsXMLFile , StandardCharsets . UTF_8 ) ;