Merge branch 'develop' into 1124_broadcast_mark_rounding_message

# Conflicts:
#	src/main/java/seng302/gameServer/ServerToClientThread.java
This commit is contained in:
William Muir
2017-08-14 16:16:04 +12:00
24 changed files with 372 additions and 280 deletions
@@ -6,29 +6,30 @@ import java.util.Map;
/**
* Created by kre39 on 12/07/17.
*/
public enum BoatActionType {
public enum BoatAction {
VMG(1),
SAILS_IN(2),
SAILS_OUT(3),
TACK_GYBE(4),
UPWIND(5),
DOWNWIND(6);
DOWNWIND(6),
MAINTAIN_HEADING(7);
private final int type;
private static final Map<Integer, BoatActionType> intToTypeMap = new HashMap<>();
private static final Map<Integer, BoatAction> intToTypeMap = new HashMap<>();
static {
for (BoatActionType type : BoatActionType.values()) {
for (BoatAction type : BoatAction.values()) {
intToTypeMap.put(type.getValue(), type);
}
}
BoatActionType(int type){
BoatAction(int type){
this.type = type;
}
public static BoatActionType getType(int value) {
public static BoatAction getType(int value) {
return intToTypeMap.get(value);
}
@@ -6,9 +6,9 @@ package seng302.gameServer.server.messages;
public class BoatActionMessage extends Message{
private final MessageType MESSAGE_TYPE = MessageType.BOAT_ACTION;
private final int MESSAGE_SIZE = 1;
private BoatActionType actionType;
private BoatAction actionType;
public BoatActionMessage(BoatActionType actionType) {
public BoatActionMessage(BoatAction actionType) {
this.actionType = actionType;
setHeader(new Header(MessageType.BOAT_ACTION, 0, (short) 1)); // the second variable is the source id
allocateBuffer();