Merge branch 'develop' into story1118_map_arrows

# Conflicts:
#	src/main/java/seng302/gameServer/MainServerThread.java
#	src/main/java/seng302/model/RaceState.java
#	src/main/java/seng302/visualiser/GameClient.java
#	src/main/java/seng302/visualiser/controllers/RaceViewController.java
This commit is contained in:
Calum
2017-08-17 00:52:41 +12:00
10 changed files with 189 additions and 96 deletions
+25 -13
View File
@@ -36,7 +36,6 @@ import seng302.utilities.XMLParser;
* Created by wmu16 on 10/07/17.
*/
public class GameState implements Runnable {
@FunctionalInterface
interface NewMessageListener {
@@ -180,6 +179,14 @@ public class GameState implements Runnable {
return windDirection;
}
public static void setWindDirection(Double newWindDirection) {
windDirection = newWindDirection;
}
public static void setWindSpeed(Double newWindSpeed) {
windSpeed = newWindSpeed;
}
public static Double getWindSpeedMMS() {
return windSpeed;
}
@@ -250,7 +257,6 @@ public class GameState implements Runnable {
}
}
/**
* Called periodically in this GameState thread to update the GameState values
*/
@@ -271,6 +277,8 @@ public class GameState implements Runnable {
checkForLegProgression(yacht);
raceFinished = false;
}
}
if (raceFinished) {
@@ -329,17 +337,20 @@ public class GameState implements Runnable {
notifyMessageListeners(
new YachtEventCodeMessage(serverYacht.getSourceId())
);
} else if (checkBoundaryCollision(serverYacht)) {
serverYacht.setLocation(
calculateBounceBack(serverYacht, serverYacht.getLocation(),
BOUNCE_DISTANCE_YACHT)
);
serverYacht.setCurrentVelocity(
serverYacht.getCurrentVelocity() * COLLISION_VELOCITY_PENALTY
);
notifyMessageListeners(
new YachtEventCodeMessage(serverYacht.getSourceId())
);
}
else{
if (checkBoundaryCollision(serverYacht)) {
serverYacht.setLocation(
calculateBounceBack(serverYacht, serverYacht.getLocation(),
BOUNCE_DISTANCE_YACHT)
);
serverYacht.setCurrentVelocity(
serverYacht.getCurrentVelocity() * COLLISION_VELOCITY_PENALTY
);
notifyMessageListeners(
new YachtEventCodeMessage(serverYacht.getSourceId())
);
}
}
}
}
@@ -426,6 +437,7 @@ public class GameState implements Runnable {
}
if (hasProgressed) {
yacht.incrementLegNumber();
sendMarkRoundingMessage(yacht);
logMarkRounding(yacht);
yacht.setHasPassedLine(false);