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
@@ -460,7 +460,7 @@ public class GameView3D {
final List<Group> wakes = new ArrayList<>();
for (ClientYacht clientYacht : yachts) {
Color colour = clientYacht.getColour();
newBoat = new BoatObject(BoatMeshType.getBoatMeshType(clientYacht.getBoatType()));
newBoat = new BoatObject(clientYacht.getBoatType());
newBoat.setFill(colour);
boatObjects.put(clientYacht, newBoat);
wakesGroup.getChildren().add(newBoat.getWake());
@@ -31,7 +31,7 @@ public class PlayerCell {
this.playerId = playerId;
this.name = yacht.getBoatName();
this.boatColor = yacht.getColour();
this.boatType = BoatMeshType.getBoatMeshType(yacht.getBoatType());
this.boatType = yacht.getBoatType();
}
public void initialize() {
@@ -111,8 +111,8 @@ public class BoatCustomizeController implements Initializable{
this.lobbyController = lobbyController;
}
public void setCurrentBoat(String boatType) {
currentBoat = BoatMeshType.getBoatMeshType(boatType);
public void setCurrentBoat(BoatMeshType boatType) {
currentBoat = boatType;
displayCurrentBoat();
}
@@ -29,19 +29,6 @@ public enum BoatMeshType {
this.fixedSail = fixedSail;
}
public static BoatMeshType getBoatMeshType(String boatType) {
switch (boatType){
case "DINGHY":
return DINGHY;
case "CAT_ATE_A_MERINGUE":
return CAT_ATE_A_MERINGUE;
case "PIRATE_SHIP":
return PIRATE_SHIP;
default:
return DINGHY;
}
}
//TODO kre39 make something not terrible to cycle through boat types
public static BoatMeshType getNextBoatType(BoatMeshType boatType) {