|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoc.message.SOCMessage
soc.message.SOCPotentialSettlements
public class SOCPotentialSettlements
This message contains a list of potential settlements.
In version 2.0.00 and newer:
startingLandArea
).
_SC_PIRI
which restricts them to certain edges;
see optional field legalSeaEdges
.
In scenario _SC_PIRI
, after initial placement, each player can place
not only at these potential locations, but also at their "lone settlement"
node previously sent in SOCBoardLayout2
as layout part "LS"
.
Field Summary | |
---|---|
int |
areaCount
How many land areas are on this board? Always 1 before version 2.0.00. |
private java.lang.String |
game
Name of game |
java.util.HashSet<java.lang.Integer>[] |
landAreasLegalNodes
Each land area's legal node coordinates. |
int[][] |
legalSeaEdges
Optional field, Legal sea edges per player for ships, if restricted. |
private int |
playerNumber
Player number, or -1 for all players (version 2.0.00 or newer) |
private java.util.Vector<java.lang.Integer> |
psList
List of potential settlements |
private static long |
serialVersionUID
|
int |
startingLandArea
Which land area number is psList within landAreasLegalNodes ?
0 if none, because the game has started. |
static int |
VERSION_FOR_PLAYERNUM_ALL
In version 2.0.00 and above, playerNumber can be -1 to indicate all players have these potential settlements. |
Constructor Summary | |
---|---|
SOCPotentialSettlements(java.lang.String ga,
int pn,
int pan,
java.util.HashSet<java.lang.Integer>[] lan,
int[][] lse)
Create a SOCPotentialSettlements message with multiple land areas, each of which have a set of legal settlements, but only one of which has potential settlements at this time. |
|
SOCPotentialSettlements(java.lang.String ga,
int pn,
java.util.Vector<java.lang.Integer> ps)
Create a SOCPotentialSettlements message. |
Method Summary | |
---|---|
java.lang.String |
getGame()
Name of game this message is for. |
int |
getPlayerNumber()
|
java.util.Vector<java.lang.Integer> |
getPotentialSettlements()
|
static SOCPotentialSettlements |
parseDataStr(java.lang.String s)
Parse the command String into a PotentialSettlements message |
java.lang.String |
toCmd()
POTENTIALSETTLEMENTS formatted command, for a message with 1 or multiple land areas. |
static java.lang.String |
toCmd(java.lang.String ga,
int pn,
int pan,
java.util.HashSet<java.lang.Integer>[] lan,
int[][] lse)
toCmd for a SOCPotentialSettlements message with multiple land areas, each of which have a set of legal settlements, but only one of which has potential settlements at this time. |
static java.lang.String |
toCmd(java.lang.String ga,
int pn,
java.util.Vector<java.lang.Integer> ps)
toCmd for a SOCPotentialSettlements message with 1 land area. |
java.lang.String |
toString()
Simple human-readable representation, used for debug purposes. |
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
public static final int VERSION_FOR_PLAYERNUM_ALL
private java.lang.String game
private int playerNumber
private java.util.Vector<java.lang.Integer> psList
public final int areaCount
public final int startingLandArea
psList
within landAreasLegalNodes
?
0 if none, because the game has started.
0 if none when game starting and players can place anywhere.
Not used if areaCount
== 1.
public final java.util.HashSet<java.lang.Integer>[] landAreasLegalNodes
Null if areaCount
== 1.
startingLandArea
public int[][] legalSeaEdges
null
because all sea edges are legal.
Legal sea edges are currently restricted only in scenario _SC_PIRI
.
If playerNumber
!= -1, legalSeaEdges
contains 1 array, the legal sea edges for that player.
Otherwise, will contain 1 array for each player position (total 4 or 6 arrays).
Each per-player array is the same format as in SOCBoardLargeAtServer.PIR_ISL_SEA_EDGES
:
A list of individual sea edge coordinates and/or ranges.
Ranges are designated by a pair of positive,negative numbers:
0xC04, -0xC0D is a range of the valid edges from C04 through C0D inclusive.
If a player position is vacant, their subarray may be empty (length 0).
Constructor Detail |
---|
public SOCPotentialSettlements(java.lang.String ga, int pn, java.util.Vector<java.lang.Integer> ps)
ga
- name of the gamepn
- the player number, or -1 for all players in v2.0.00
or newer (see ps for implications)ps
- the list of potential settlement nodes; if pn == -1
and the client and server are at least
version 2.0.00 (VERSION_FOR_PLAYERNUM_ALL
),
ps also is the list of legal settlements.public SOCPotentialSettlements(java.lang.String ga, int pn, int pan, java.util.HashSet<java.lang.Integer>[] lan, int[][] lse) throws java.lang.IllegalArgumentException
ga
- name of the gamepn
- the player number, or -1 for all playerspan
- Potential settlements' land area number, or 0 if the
game has started, so none of the land areas equals the
list of potential settlements. In that case use lan[0]
to hold the potential settlements node list.
If the game is just starting and the player can start anywhere (pan == 0), then lan[0] should be null.
lan
- Each land area's legal node lists.
List number pan will be sent as the list of
potential settlements.
If none of the land areas equals the list of potential
settlements, because the game has started,
use index 0 for that potentials list.
Otherwise index 0 is unused (null).
If the game is just starting and the player can start anywhere
(pan == 0), then lan[0] should be null,
and the getPotentialSettlements()
list will be formed by
combining lan[1] .. lan[n-1].
lse
- Legal sea edges for ships if restricted, or null
; see legalSeaEdges
field for format
java.lang.IllegalArgumentException
- if ln[pan] == null,
or if ln[i] == null for any i > 0Method 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 getPlayerNumber()
public java.util.Vector<java.lang.Integer> getPotentialSettlements()
public java.lang.String toCmd()
toCmd(String, int, Vector)
or toCmd(String, int, int, HashSet[], int[][])
.
toCmd
in class SOCMessage
public static java.lang.String toCmd(java.lang.String ga, int pn, java.util.Vector<java.lang.Integer> ps)
POTENTIALSETTLEMENTS sep game sep2 playerNumber sep2 psList
ga
- the game namepn
- the player numberps
- the list of potential settlements
public static java.lang.String toCmd(java.lang.String ga, int pn, int pan, java.util.HashSet<java.lang.Integer>[] lan, int[][] lse)
POTENTIALSETTLEMENTS sep game sep2 playerNumber sep2 psList sep2 NA sep2 (number of areas) sep2 PAN sep2 (pan) { sep2 LA# sep2 legalNodesList }+ { sep2 SE { sep2 (legalSeaEdgesList | 0) } }* LA# is the land area number "LA1" or "LA2". None of the LA#s will be PAN's (pan) number.
ga
- name of the gamepn
- the player number, or -1 for all playerspan
- Potential settlements' land area number, or 0 if the
game has started, so none of the land areas equals the
list of potential settlements. In that case use lan[0]
to hold the potential settlements node list.lan
- Each land area's legal node lists.
List number pan will be sent as the list of
potential settlements.
If none of the land areas equals the list of potential
settlements, because the game has started,
use index 0 for that potentials list.
Otherwise index 0 is unused (null).lse
- Legal sea edges for ships if restricted, or null
; see legalSeaEdges
field for format
public static SOCPotentialSettlements parseDataStr(java.lang.String s)
s
- the String to parse
public java.lang.String toString()
SOCMessage
toString
in class SOCMessage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |