Added boat velocity to information provided by mock
#story[778]
This commit is contained in:
@@ -86,8 +86,11 @@ public class MockOutput implements Runnable
|
||||
/**
|
||||
* Used to give the mocOutput information about boat location to be made into a message and sent
|
||||
*/
|
||||
public synchronized void parseBoatLocation(int sourceID, double lat, double lon, double heading){
|
||||
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(sourceID, lat, lon, boatLocationSequenceNumber, heading);
|
||||
public synchronized void parseBoatLocation(int sourceID, double lat, double lon, double heading, double speed){
|
||||
|
||||
int newSpeed = (int) Math.round((speed * Constants.KnotsToMetersPerSecondConversionFactor * 1000));
|
||||
|
||||
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(sourceID, lat, lon, boatLocationSequenceNumber, heading, newSpeed);
|
||||
//iterates the sequence number
|
||||
boatLocationSequenceNumber++;
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public class Race implements Runnable {
|
||||
for (int i = 0; i < startingBoats.size(); i++) {
|
||||
Boat boat = startingBoats.get((i + boatOffset) % startingBoats.size());
|
||||
if (boat != null) {
|
||||
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading());
|
||||
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading(), boat.getScaledVelocity());
|
||||
boatStatusMessages.add(new BoatStatusMessage(boat.getSourceID(),
|
||||
boat.getCurrentLeg().getLegNumber() >= 0 ? BoatStatus.RACING : BoatStatus.DNF, boat.getCurrentLeg().getLegNumber()));
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class Race implements Runnable {
|
||||
updatePosition(boat, Math.round(1000 / lastFPS) > 20 ? 15 : Math.round(1000 / lastFPS));
|
||||
checkPosition(boat, totalTimeElapsed);
|
||||
}
|
||||
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading());
|
||||
mockOutput.parseBoatLocation(boat.getSourceID(), boat.getCurrentPosition().getLatitude(), boat.getCurrentPosition().getLongitude(), boat.getHeading(), boat.getScaledVelocity());
|
||||
boatStatusMessages.add(new BoatStatusMessage(boat.getSourceID(),
|
||||
boat.getCurrentLeg().getLegNumber() >= 0 ? BoatStatus.RACING : BoatStatus.DNF, boat.getCurrentLeg().getLegNumber()));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user