diff --git a/src/main/java/seng302/gameServer/GameState.java b/src/main/java/seng302/gameServer/GameState.java index 41c619b7..8ff2556c 100644 --- a/src/main/java/seng302/gameServer/GameState.java +++ b/src/main/java/seng302/gameServer/GameState.java @@ -18,6 +18,7 @@ import seng302.utilities.XMLParser; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.util.*; +import seng302.visualiser.fxObjects.assets_3D.BoatMeshType; /** * A Static class to hold information about the current state of the game (model) @@ -704,7 +705,7 @@ public class GameState implements Runnable { playerYacht.setBoatColor(yachtColor); } else if (requestType.equals(CustomizeRequestType.SHAPE)) { String type = new String(customizeData); - playerYacht.setBoatType(type); + playerYacht.setBoatType(BoatMeshType.valueOf(type)); } } diff --git a/src/main/java/seng302/gameServer/ServerToClientThread.java b/src/main/java/seng302/gameServer/ServerToClientThread.java index 728e6adb..eb5a9ad0 100644 --- a/src/main/java/seng302/gameServer/ServerToClientThread.java +++ b/src/main/java/seng302/gameServer/ServerToClientThread.java @@ -33,6 +33,7 @@ import seng302.model.stream.packets.PacketType; import seng302.model.stream.packets.StreamPacket; import seng302.model.stream.xml.generator.RaceXMLTemplate; import seng302.utilities.XMLGenerator; +import seng302.visualiser.fxObjects.assets_3D.BoatMeshType; /** * A class describing a single connection to a Client for the purposes of sending and receiving on @@ -125,7 +126,7 @@ public class ServerToClientThread implements Runnable { lName = all.get(ThreadLocalRandom.current().nextInt(0, all.size())); ServerYacht yacht = new ServerYacht( - "DINGHY", sourceId, sourceId.toString(), fName, fName + " " + lName, "NZ" + BoatMeshType.DINGHY, sourceId, sourceId.toString(), fName, fName + " " + lName, "NZ" ); player = new Player(socket, yacht); diff --git a/src/main/java/seng302/model/ClientYacht.java b/src/main/java/seng302/model/ClientYacht.java index 1ebaa3fc..2bc1ed91 100644 --- a/src/main/java/seng302/model/ClientYacht.java +++ b/src/main/java/seng302/model/ClientYacht.java @@ -15,6 +15,7 @@ import javafx.beans.property.ReadOnlyLongWrapper; import javafx.scene.paint.Color; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import seng302.visualiser.fxObjects.assets_3D.BoatMeshType; /** * Yacht class for the racing boat.
Class created to store more variables (eg. boat statuses) @@ -37,7 +38,7 @@ public class ClientYacht extends Observable { private Logger logger = LoggerFactory.getLogger(ClientYacht.class); - private String boatType; + private BoatMeshType boatType; private Integer sourceId; private String hullID; //matches HullNum in the XML spec. private String shortName; @@ -64,7 +65,7 @@ public class ClientYacht extends Observable { private ReadOnlyIntegerWrapper placingProperty = new ReadOnlyIntegerWrapper(); private Color colour; - public ClientYacht(String boatType, Integer sourceId, String hullID, String shortName, + public ClientYacht(BoatMeshType boatType, Integer sourceId, String hullID, String shortName, String boatName, String country) { this.boatType = boatType; this.sourceId = sourceId; @@ -88,7 +89,7 @@ public class ClientYacht extends Observable { super.addObserver(o); } - public String getBoatType() { + public BoatMeshType getBoatType() { return boatType; } diff --git a/src/main/java/seng302/model/ServerYacht.java b/src/main/java/seng302/model/ServerYacht.java index 99314776..e7d936ca 100644 --- a/src/main/java/seng302/model/ServerYacht.java +++ b/src/main/java/seng302/model/ServerYacht.java @@ -12,6 +12,7 @@ import seng302.utilities.GeoUtility; import java.util.HashMap; import java.util.Observable; import java.util.Observer; +import seng302.visualiser.fxObjects.assets_3D.BoatMeshType; /** * Yacht class for the racing boat.
Class created to store more variables (eg. boat statuses)
@@ -25,7 +26,7 @@ public class ServerYacht {
public static final Double TURN_STEP = 5.0;
//Boat info
- private String boatType;
+ private BoatMeshType boatType;
private Integer sourceId;
private String hullID; //matches HullNum in the XML spec.
private String shortName;
@@ -57,7 +58,7 @@ public class ServerYacht {
private Long powerUpStartTime;
- public ServerYacht(String boatType, Integer sourceId, String hullID, String shortName,
+ public ServerYacht(BoatMeshType boatType, Integer sourceId, String hullID, String shortName,
String boatName, String country) {
this.boatType = boatType;
this.boatStatus = BoatStatus.PRESTART;
@@ -421,11 +422,11 @@ public class ServerYacht {
return boatColor;
}
- public void setBoatType(String boatType) {
+ public void setBoatType(BoatMeshType boatType) {
this.boatType = boatType;
}
- public String getBoatType() {
+ public BoatMeshType getBoatType() {
return boatType;
}
}
diff --git a/src/main/java/seng302/utilities/XMLParser.java b/src/main/java/seng302/utilities/XMLParser.java
index 7a8bbac4..71da1248 100644
--- a/src/main/java/seng302/utilities/XMLParser.java
+++ b/src/main/java/seng302/utilities/XMLParser.java
@@ -18,6 +18,7 @@ import seng302.model.stream.xml.parser.RaceXMLData;
import seng302.model.stream.xml.parser.RegattaXMLData;
import seng302.model.token.Token;
import seng302.model.token.TokenType;
+import seng302.visualiser.fxObjects.assets_3D.BoatMeshType;
/**
* Utilities for parsing XML documents
@@ -139,7 +140,7 @@ public class XMLParser {
if (currentBoat.getNodeName().equals("Boat")) {
// Boat boat = new Boat(currentBoat);
ClientYacht yacht = new ClientYacht(
- XMLParser.getNodeAttributeString(currentBoat, "Type"),
+ BoatMeshType.valueOf(XMLParser.getNodeAttributeString(currentBoat, "Type")),
XMLParser.getNodeAttributeInt(currentBoat, "SourceID"),
XMLParser.getNodeAttributeString(currentBoat, "HullNum"),
XMLParser.getNodeAttributeString(currentBoat, "ShortName"),
diff --git a/src/main/java/seng302/visualiser/GameView3D.java b/src/main/java/seng302/visualiser/GameView3D.java
index 73815023..63d0203d 100644
--- a/src/main/java/seng302/visualiser/GameView3D.java
+++ b/src/main/java/seng302/visualiser/GameView3D.java
@@ -460,7 +460,7 @@ public class GameView3D {
final List