Merge branch 'master' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into controllerSplit
# Conflicts: # racevisionGame/src/main/java/visualiser/Controllers/HostController.java # racevisionGame/src/main/java/visualiser/Controllers/MainController.java # racevisionGame/src/main/java/visualiser/Controllers/RaceViewController.java # racevisionGame/src/main/java/visualiser/Controllers/StartController.java # racevisionGame/src/main/java/visualiser/Controllers/TitleController.java # racevisionGame/src/main/resources/visualiser/scenes/raceView.fxml # racevisionGame/src/main/resources/visualiser/scenes/titleScreen.fxml
This commit is contained in:
@@ -62,7 +62,7 @@ public class RaceXMLCreator {
|
||||
* @throws SAXException error in schema file
|
||||
* @throws ParserConfigurationException error in parsing the schema file
|
||||
*/
|
||||
public static String alterRaceToWind(String s, double degrees) throws XMLReaderException, InvalidRaceDataException, JAXBException, IOException, SAXException, ParserConfigurationException {
|
||||
public static String alterRaceToWind(String s, double degrees, boolean tutorial) throws XMLReaderException, InvalidRaceDataException, JAXBException, IOException, SAXException, ParserConfigurationException {
|
||||
RaceXMLReader reader = new RaceXMLReader(s, XMLFileType.ResourcePath);
|
||||
|
||||
XMLRace race = XMLUtilities.xmlToClass(
|
||||
@@ -70,7 +70,11 @@ public class RaceXMLCreator {
|
||||
RaceXMLCreator.class.getClassLoader().getResource("mock/mockXML/schema/raceSchema.xsd"),
|
||||
XMLRace.class);
|
||||
|
||||
setRaceXMLAtCurrentTimeToNow(race);
|
||||
if(tutorial){
|
||||
setRaceXMLAtCurrentTimeToNow(race, 1000l, 5000l);
|
||||
} else {
|
||||
setRaceXMLAtCurrentTimeToNow(race);
|
||||
}
|
||||
|
||||
double raceOriginalBearing = getLineAngle(getLeewardGate(reader).getMark1Position(), getWindwardGate(reader).getMark1Position());
|
||||
|
||||
@@ -81,6 +85,7 @@ public class RaceXMLCreator {
|
||||
return XMLUtilities.classToXML(race);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rotate the features in a race such as the boundary, and the marks.
|
||||
* @param race the race to alter
|
||||
@@ -168,14 +173,11 @@ public class RaceXMLCreator {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the xml description of the race to show the race was created now, and starts in 4 minutes
|
||||
* @param raceXML The race.xml contents.
|
||||
*/
|
||||
public static void setRaceXMLAtCurrentTimeToNow(XMLRace raceXML) {
|
||||
|
||||
|
||||
public static void setRaceXMLAtCurrentTimeToNow(XMLRace raceXML, long racePrestartTime, long racePreparatoryTime){
|
||||
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + Constants.RacePreparatoryTime;
|
||||
long millisecondsToAdd = racePrestartTime + racePreparatoryTime;
|
||||
long secondsToAdd = millisecondsToAdd / 1000;
|
||||
//Scale the time using our time scalar.
|
||||
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
|
||||
@@ -186,4 +188,13 @@ public class RaceXMLCreator {
|
||||
raceXML.getRaceStartTime().setTime(dateFormat.format(creationTime.plusSeconds(secondsToAdd)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the xml description of the race to show the race was created now, and starts in 4 minutes
|
||||
* @param raceXML The race.xml contents.
|
||||
*/
|
||||
public static void setRaceXMLAtCurrentTimeToNow(XMLRace raceXML) {
|
||||
setRaceXMLAtCurrentTimeToNow(raceXML, Constants.RacePreStartTime, Constants.RacePreparatoryTime);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user