Fixed Tutorial not being able to run #story[1185]
This commit is contained in:
@@ -107,9 +107,10 @@ public class Event {
|
||||
try {
|
||||
//this.raceXML = RaceXMLCreator.alterRaceToWind(raceXMLFile, 90);
|
||||
this.raceXML = XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8);
|
||||
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8));
|
||||
if(mapIndex==4){
|
||||
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8), 1000, 5000);
|
||||
} else {
|
||||
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8));
|
||||
}
|
||||
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
||||
this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8);
|
||||
@@ -144,14 +145,23 @@ public class Event {
|
||||
Bearing.fromDegrees(225),
|
||||
12
|
||||
);
|
||||
|
||||
MockRace mockRace = new MockRace(
|
||||
boatDataSource,
|
||||
raceDataSource,
|
||||
regattaDataSource,
|
||||
this.boatPolars,
|
||||
Constants.RaceTimeScale,
|
||||
windGenerator );
|
||||
|
||||
if(mapIndex==4){
|
||||
mockRace.setRacePreStartTime(1000);
|
||||
mockRace.setRacePreparatoryTime(5000);
|
||||
}
|
||||
|
||||
|
||||
RaceLogic newRace = new RaceLogic(
|
||||
new MockRace(
|
||||
boatDataSource,
|
||||
raceDataSource,
|
||||
regattaDataSource,
|
||||
this.boatPolars,
|
||||
Constants.RaceTimeScale,
|
||||
windGenerator ),
|
||||
mockRace,
|
||||
this.latestMessages,
|
||||
this.compositeCommand);
|
||||
|
||||
|
||||
@@ -68,7 +68,9 @@ public class MockRace extends RaceState {
|
||||
|
||||
private ActiveObserverCommand activeObserverCommand;
|
||||
|
||||
private long racePreStartTime = Constants.RacePreStartTime;
|
||||
|
||||
private long racePreparatoryTime = Constants.RacePreparatoryTime;
|
||||
|
||||
/**
|
||||
* Constructs a race object with a given RaceDataSource, BoatDataSource, and RegattaDataSource and sends events to the given mockOutput.
|
||||
@@ -167,15 +169,15 @@ public class MockRace extends RaceState {
|
||||
long timeToStart = - this.getRaceClock().getDurationMilli();
|
||||
|
||||
|
||||
if (timeToStart > Constants.RacePreStartTime) {
|
||||
if (timeToStart > racePreStartTime) {
|
||||
//Time > 3 minutes is the prestart period.
|
||||
this.setRaceStatusEnum(RaceStatusEnum.PRESTART);
|
||||
|
||||
} else if ((timeToStart <= Constants.RacePreStartTime) && (timeToStart >= Constants.RacePreparatoryTime)) {
|
||||
} else if ((timeToStart <= racePreStartTime) && (timeToStart >= racePreparatoryTime)) {
|
||||
//Time between [1, 3] minutes is the warning period.
|
||||
this.setRaceStatusEnum(RaceStatusEnum.WARNING);
|
||||
|
||||
} else if ((timeToStart <= Constants.RacePreparatoryTime) && (timeToStart > 0)) {
|
||||
} else if ((timeToStart <= racePreparatoryTime) && (timeToStart > 0)) {
|
||||
//Time between (0, 1] minutes is the preparatory period.
|
||||
this.setRaceStatusEnum(RaceStatusEnum.PREPARATORY);
|
||||
|
||||
@@ -188,6 +190,13 @@ public class MockRace extends RaceState {
|
||||
|
||||
}
|
||||
|
||||
public void setRacePreStartTime(long racePreStartTime) {
|
||||
this.racePreStartTime = racePreStartTime;
|
||||
}
|
||||
|
||||
public void setRacePreparatoryTime(long racePreparatoryTime) {
|
||||
this.racePreparatoryTime = racePreparatoryTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status of all boats in the race to RACING.
|
||||
|
||||
Reference in New Issue
Block a user