Small documentation changes.

tags: #story[1142]
This commit is contained in:
Alistair McIntyre
2017-08-17 12:31:15 +12:00
parent d73e4f8ec5
commit ac279583df
3 changed files with 10 additions and 4 deletions
@@ -60,7 +60,7 @@ public class GameState implements Runnable {
public static Double windDirection;
private static Double windSpeed;
private static Boolean customizationFlag;
private static Boolean customizationFlag; // dirty flag to tell if a player has customized their boat.
private static String hostIpAddress;
private static List<Player> players;
@@ -575,16 +575,21 @@ public class GameState implements Runnable {
return false;
}
/**
* Handles player customization.
*
* @param playerID The ID of the player being modified.
* @param requestType the type of player customization the player wants
* @param customizeData the data related to the customization (color, name, shape)
*/
public static void customizePlayer(long playerID, CustomizeRequestType requestType,
byte[] customizeData) {
System.out.println(playerID + " " + requestType.toString());
ServerYacht playerYacht = yachts.get((int) playerID);
if (requestType.equals(CustomizeRequestType.NAME)) {
String name = new String(customizeData);
playerYacht.setBoatName(name);
} else if (requestType.equals(CustomizeRequestType.COLOR)) {
System.out.println(customizeData.length);
int red = customizeData[0] & 0xFF;
int green = customizeData[1] & 0xFF;
int blue = customizeData[2] & 0xFF;
@@ -210,7 +210,7 @@ public class ServerToClientThread implements Runnable, Observer {
GameState.customizePlayer(sourceID, requestType,
Arrays.copyOfRange(payload, 6, payload.length));
GameState.setCustomizationFlag();
//// TODO: 17/08/2017 ajm412: Send a response packet here.
// TODO: 17/08/2017 ajm412: Send a response packet here, not really necessary until we do shapes.
break;
}
} else {