Class games.Battle.shared.comm.TurnDiff
All Packages Class Hierarchy This Package Previous Next Index
Class games.Battle.shared.comm.TurnDiff
java.lang.Object
|
+----games.Battle.shared.comm.BattlePacket
|
+----games.Battle.shared.comm.TurnDiff
- public class TurnDiff
- extends BattlePacket
A TurnDiff is a delta of the game board sent to every player on every
"iteration" of the game. It only contains the differences in the game
board that are the result of this turn to help keep transmission costs
to a minimum.
-
GAMEOVER
- GAMEOVER is the used to say hasta la vista, baby.
-
NORMAL
- NORMAL is the usual tag placed on a turndiff.
-
board
- the board.
-
player
- the player whose point of view this turndiff is from.
-
TurnDiff(Board, int)
- Constructor which indicates which game board this TurnDiff is
going to be reading/writing to, and which player in the game
the diff is being constructed for.
-
TurnDiff(Board, int, byte)
- Constructor which indicates which game board this TurnDiff is
going to be reading/writing to, and which player in the game
the diff is being constructed for.
-
asciiDump(byte[])
- Debugging output
-
fromBytes(byte[])
- Build a turn diff based on the data inside the given array of bytes
-
getTag()
- return the tag associated with this turn diff.
-
makeBytes()
- Produce an array of bytes representing the turn diff.
-
toBytes()
- return the bytes for the turn diff.
board
protected Board board
- the board.
player
protected int player
- the player whose point of view this turndiff is from.
NORMAL
public final static byte NORMAL
- NORMAL is the usual tag placed on a turndiff.
GAMEOVER
public final static byte GAMEOVER
- GAMEOVER is the used to say hasta la vista, baby.
TurnDiff
public TurnDiff(Board board,
int player)
- Constructor which indicates which game board this TurnDiff is
going to be reading/writing to, and which player in the game
the diff is being constructed for.
- Parameters:
- board - the board the turn diff is representing
- the - player the turn diff is representing
TurnDiff
public TurnDiff(Board board,
int player,
byte tag)
- Constructor which indicates which game board this TurnDiff is
going to be reading/writing to, and which player in the game
the diff is being constructed for. Also takes a tag, so that
the server can indicate game over.
- Parameters:
- board - the board the turn diff is representing
- player - the player the turn diff is representing
- tag - the tag for game over or not
getTag
public final byte getTag()
- return the tag associated with this turn diff.
makeBytes
public void makeBytes()
- Produce an array of bytes representing the turn diff.
toBytes
public byte[] toBytes()
- return the bytes for the turn diff.
- Overrides:
- toBytes in class BattlePacket
fromBytes
public void fromBytes(byte array[])
- Build a turn diff based on the data inside the given array of bytes
- Parameters:
- array - the array of bytes
- Overrides:
- fromBytes in class BattlePacket
asciiDump
public void asciiDump(byte array[])
- Debugging output
All Packages Class Hierarchy This Package Previous Next Index