|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.message.SOCMessage soc.message.SOCBoardLayout
public class SOCBoardLayout
This message contains the board layout information. That is, the hex layout, the number layout, and where the robber is. This does not contain information about where the player's pieces are on the board.
This message sends the standard board layout of the
original game, SOCBoard.BOARD_ENCODING_ORIGINAL
.
As of version 1.1.08, there is a newer board layout for
game expansions. See the new message type BOARDLAYOUT2
.
Unlike SOCBoardLayout2
, the dice numbers are mapped before sending
over the network, and unmapped when received. This is because of a change in
SOCBoard.getNumberLayout()
in 1.1.08, the version which
introduced SOCBoardLayout2. Older clients/servers will still need the
mapping done, so it's now done here instead of in SOCBoard.
In v2.0.00 and newer, the hex layout values for WATER_HEX and DESERT_HEX
were changed to allow new types of land hex. Just like the dice numbers,
this is mapped in the constructor, sent over the network, and unmapped in
getHexLayout()
, for backwards compatibility with older clients.
Field Summary | |
---|---|
private static int[] |
boardNum2sentNum
Map of dice rolls to values in numberLayout . |
private java.lang.String |
game
Name of game |
private int[] |
hexLayout
The hex layout; a mapping/unmapping step is done in constructor/ getHexLayout() . |
private int[] |
numberLayout
The dice number layout; a mapping/unmapping step is done in constructor/ getNumberLayout() . |
private int |
robberHex
Where the robber is |
private static int |
SENTLAND_DESERT
Hex land type numbers sent over the network. |
private static int |
SENTLAND_WATER
Hex land type numbers sent over the network. |
private static int[] |
sentNum2BoardNum
Map of values in numberLayout to dice rolls: |
private static long |
serialVersionUID
|
Constructor Summary | |
---|---|
|
SOCBoardLayout(java.lang.String ga,
int[] hl,
int[] nl,
int rh)
Create a SOCBoardLayout message |
private |
SOCBoardLayout(java.lang.String ga,
int[] hl,
int[] nl,
int rh,
boolean alreadyMapped)
Create a SOCBoardLayout message |
Method Summary | |
---|---|
java.lang.String |
getGame()
Name of game this message is for. |
int[] |
getHexLayout()
Get the hex layout, already mapped from the BOARDLAYOUT message value range to the SOCBoard.setHexLayout(int[]) value range. |
int[] |
getNumberLayout()
Get the dice number layout, already mapped from the BOARDLAYOUT message value range to the SOCBoard.setNumberLayout(int[]) value range. |
int |
getRobberHex()
|
static SOCBoardLayout |
parseDataStr(java.lang.String s)
Parse the command String into a BoardLayout message |
java.lang.String |
toCmd()
Formatted string to send this BOARDLAYOUT over the network. |
static java.lang.String |
toCmd(java.lang.String ga,
int[] hl,
int[] nl,
int rh)
Formatted string to send this BOARDLAYOUT over the network. |
java.lang.String |
toString()
Render the SOCBoardLayout in human-readable form. |
Methods inherited from class soc.message.SOCMessage |
---|
arrayIntoStringBuf, enumIntoStringBuf, getClassNameShort, getMaximumVersion, getMinimumVersion, getType, isSingleLineAndSafe, isSingleLineAndSafe, toMsg |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface soc.message.SOCMessageForGame |
---|
getType |
Field Detail |
---|
private static final long serialVersionUID
private static final int[] boardNum2sentNum
numberLayout
. Formerly in SOCBoard.
private static final int[] sentNum2BoardNum
numberLayout
to dice rolls:-1 : robber 0 : 2 1 : 3 2 : 4 3 : 5 4 : 6 5 : 8 (7 is skipped) 6 : 9 7 : 10 8 : 11 9 : 12Formerly in SOCBoard.
private static final int SENTLAND_WATER
SOCBoard.WATER_HEX
, SOCBoard.DESERT_HEX
.
private static final int SENTLAND_DESERT
SOCBoard.WATER_HEX
, SOCBoard.DESERT_HEX
.
private java.lang.String game
private int[] hexLayout
getHexLayout()
.
private int[] numberLayout
getNumberLayout()
.
private int robberHex
Constructor Detail |
---|
public SOCBoardLayout(java.lang.String ga, int[] hl, int[] nl, int rh)
ga
- the name of the gamehl
- the hex layout; not mapped yet from SOCBoard's value range,
so the constructor will map it.nl
- the dice number layout; not mapped yet, so the constructor
will map it from the SOCBoard.getNumberLayout()
value
range to the BOARDLAYOUT message's value range.rh
- the robber hexprivate SOCBoardLayout(java.lang.String ga, int[] hl, int[] nl, int rh, boolean alreadyMapped)
ga
- the name of the gamehl
- the hex layoutnl
- the number layoutrh
- the robber hexalreadyMapped
- have the hex layout and number layout already been mapped?Method Detail |
---|
public java.lang.String getGame()
SOCMessageForGame
null
if message is in per-game structures or code.
At the server, the message treater dispatches incoming SOCMessageForGame
s
based on their getGame()
:
null
: Message is ignored
SOCMessage.GAME_NONE
: Message is handled by SOCServer
itself
GameHandler
for that game's type. If no game with that name is found,
the message is ignored.
getGame
in interface SOCMessageForGame
SOCMessage.GAME_NONE
public int[] getHexLayout()
SOCBoard.setHexLayout(int[])
value range.
public int[] getNumberLayout()
SOCBoard.setNumberLayout(int[])
value range.
public int getRobberHex()
public java.lang.String toCmd()
toCmd
in class SOCMessage
public static java.lang.String toCmd(java.lang.String ga, int[] hl, int[] nl, int rh)
public static SOCBoardLayout parseDataStr(java.lang.String s)
s
- the String to parse
public java.lang.String toString()
toString
in class SOCMessage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |