Merge remote-tracking branch 'origin/master' into story_51_rounding_fix
# Conflicts: # racevisionGame/src/main/java/mock/app/Event.java
This commit is contained in:
@@ -109,10 +109,11 @@ public class Event {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
//this.raceXML = XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8);
|
//this.raceXML = XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8);
|
||||||
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8));
|
|
||||||
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, 300, false);
|
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, 300, false);
|
||||||
if(mapIndex==4){
|
if(mapIndex==4){
|
||||||
this.raceXML = Event.setRaceXMLAtCurrentTimeToNow(XMLReader.readXMLFileToString(raceXMLFile, StandardCharsets.UTF_8), 1000, 5000);
|
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.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
||||||
@@ -148,14 +149,23 @@ public class Event {
|
|||||||
Bearing.fromDegrees(225),
|
Bearing.fromDegrees(225),
|
||||||
12
|
12
|
||||||
);
|
);
|
||||||
RaceLogic newRace = new RaceLogic(
|
|
||||||
new MockRace(
|
MockRace mockRace = new MockRace(
|
||||||
boatDataSource,
|
boatDataSource,
|
||||||
raceDataSource,
|
raceDataSource,
|
||||||
regattaDataSource,
|
regattaDataSource,
|
||||||
this.boatPolars,
|
this.boatPolars,
|
||||||
Constants.RaceTimeScale,
|
Constants.RaceTimeScale,
|
||||||
windGenerator ),
|
windGenerator );
|
||||||
|
|
||||||
|
if(mapIndex==4){
|
||||||
|
mockRace.setRacePreStartTime(1000);
|
||||||
|
mockRace.setRacePreparatoryTime(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RaceLogic newRace = new RaceLogic(
|
||||||
|
mockRace,
|
||||||
this.latestMessages,
|
this.latestMessages,
|
||||||
this.compositeCommand);
|
this.compositeCommand);
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ public class MockRace extends RaceState {
|
|||||||
|
|
||||||
private ActiveObserverCommand activeObserverCommand;
|
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.
|
* Constructs a race object with a given RaceDataSource, BoatDataSource, and RegattaDataSource and sends events to the given mockOutput.
|
||||||
@@ -162,15 +164,15 @@ public class MockRace extends RaceState {
|
|||||||
long timeToStart = - this.getRaceClock().getDurationMilli();
|
long timeToStart = - this.getRaceClock().getDurationMilli();
|
||||||
|
|
||||||
|
|
||||||
if (timeToStart > Constants.RacePreStartTime) {
|
if (timeToStart > racePreStartTime) {
|
||||||
//Time > 3 minutes is the prestart period.
|
//Time > 3 minutes is the prestart period.
|
||||||
this.setRaceStatusEnum(RaceStatusEnum.PRESTART);
|
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.
|
//Time between [1, 3] minutes is the warning period.
|
||||||
this.setRaceStatusEnum(RaceStatusEnum.WARNING);
|
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.
|
//Time between (0, 1] minutes is the preparatory period.
|
||||||
this.setRaceStatusEnum(RaceStatusEnum.PREPARATORY);
|
this.setRaceStatusEnum(RaceStatusEnum.PREPARATORY);
|
||||||
|
|
||||||
@@ -183,6 +185,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.
|
* Sets the status of all boats in the race to RACING.
|
||||||
|
|||||||
Reference in New Issue
Block a user