Changed the boatType attribute from all around the place from String lit to enum

#story[1274]
This commit is contained in:
William Muir
2017-09-22 21:00:28 +12:00
parent da8c91f5c1
commit 22fdf1e4ac
13 changed files with 28 additions and 38 deletions
@@ -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));
}
}
@@ -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);