WIP: Implemented basic mark rounding algorithm.

Removed RacePosition class. Instead marks are just grabbed from the mark order class when necessary.
No marks are stored as an attribute in the yacht class but the 'currentMarkSeqID' which is used to get current, and surrounding marks.
Works for all marks in between but not including starting and finishing gate as no angle can be made with them. Still to work out how to implement this

 #story[1124]
This commit is contained in:
William Muir
2017-08-07 00:23:54 +12:00
parent 43788bd153
commit 7f0329dda6
6 changed files with 148 additions and 159 deletions
@@ -4,9 +4,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import seng302.gameServer.server.messages.BoatActionType;
import seng302.model.Player;
import seng302.model.Yacht;
import seng302.model.mark.MarkOrder;
/**
* A Static class to hold information about the current state of the game (model)
@@ -14,6 +17,8 @@ import seng302.model.Yacht;
*/
public class GameState implements Runnable {
private Logger logger = LoggerFactory.getLogger(MarkOrder.class);
private static Integer STATE_UPDATES_PER_SECOND = 60;
private static Long previousUpdateTime;
@@ -25,6 +30,7 @@ public class GameState implements Runnable {
private static Map<Integer, Yacht> yachts;
private static Boolean isRaceStarted;
private static GameStages currentStage;
private static MarkOrder markOrder;
private static long startTime;
private static Map<Player, String> playerStringMap = new HashMap<>();
@@ -53,8 +59,9 @@ public class GameState implements Runnable {
//set this when game stage changes to prerace
previousUpdateTime = System.currentTimeMillis();
yachts = new HashMap<>();
markOrder = new MarkOrder(); //This could be instantiated at some point with a select map?
new Thread(this).start();
new Thread(this).start(); //Run the auto updates on the game state
}
public static String getHostIpAddress() {
@@ -100,6 +107,10 @@ public class GameState implements Runnable {
GameState.currentStage = currentStage;
}
public static MarkOrder getMarkOrder() {
return markOrder;
}
public static long getStartTime(){
return startTime;
}