Project cleanup pre merge.
This commit is contained in:
@@ -15,93 +15,92 @@ import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SendBallEntryMessage extends ClientNetMsg {
|
||||
|
||||
public int playerID;
|
||||
public String description;
|
||||
public int msgType;
|
||||
public int ballColor;
|
||||
public static final int ADDBALL = 4;
|
||||
public static final int WHITEBALL = 2;
|
||||
public static final int BLACKBALL = 1;
|
||||
public static final int ADDBALL = 4;
|
||||
public static final int WHITEBALL = 2;
|
||||
public static final int BLACKBALL = 1;
|
||||
public int playerID;
|
||||
public String description;
|
||||
public int msgType;
|
||||
public int ballColor;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public SendBallEntryMessage(PlayerCharacter pc) {
|
||||
super(Protocol.SENDBALLENTRY);
|
||||
}
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public SendBallEntryMessage(PlayerCharacter pc) {
|
||||
super(Protocol.SENDBALLENTRY);
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
||||
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
||||
* past the limit) then this constructor Throws that Exception to the
|
||||
* caller.
|
||||
*/
|
||||
public SendBallEntryMessage(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.SENDBALLENTRY, origin, reader);
|
||||
}
|
||||
/**
|
||||
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
||||
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
||||
* past the limit) then this constructor Throws that Exception to the
|
||||
* caller.
|
||||
*/
|
||||
public SendBallEntryMessage(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.SENDBALLENTRY, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public SendBallEntryMessage(SendBallEntryMessage msg) {
|
||||
super(Protocol.SENDBALLENTRY);
|
||||
}
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public SendBallEntryMessage(SendBallEntryMessage msg) {
|
||||
super(Protocol.SENDBALLENTRY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.msgType = reader.getInt();
|
||||
|
||||
switch (this.msgType){
|
||||
case ADDBALL:
|
||||
this.readAddBall(reader);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void readAddBall(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.getInt(); // 1 ?
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.getInt(); // source player type
|
||||
reader.getInt(); // source player ID
|
||||
|
||||
reader.getInt(); // targetType
|
||||
reader.getInt(); // targetID (same as this.playerID)
|
||||
this.description = reader.getString();
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.getInt(); // 100, max ball mark
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.get();
|
||||
this.ballColor = reader.getInt();
|
||||
reader.get();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
}
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.msgType = reader.getInt();
|
||||
|
||||
switch (this.msgType) {
|
||||
case ADDBALL:
|
||||
this.readAddBall(reader);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void readAddBall(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.getInt(); // 1 ?
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.getInt(); // source player type
|
||||
reader.getInt(); // source player ID
|
||||
|
||||
reader.getInt(); // targetType
|
||||
reader.getInt(); // targetID (same as this.playerID)
|
||||
this.description = reader.getString();
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.getInt(); // 100, max ball mark
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.get();
|
||||
this.ballColor = reader.getInt();
|
||||
reader.get();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user