|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.game.SOCResourceConstants
public class SOCResourceConstants
This is a list of constants for representing types of resources in Settlers of Catan.
Warning: Many pieces of code depend on these values and their count.
Clay is first (1), Wood is last (5), Unknown is after wood.
Those are the 5 resource types (count==5 or ==6 (unknown) is also assumed).
Adding a new resource type would require changes in many places.
SOCRobotBrain.estimateResourceRarity is one of many examples.
Constants in other places (like SOCPlayerElement.CLAY
)
have the same hardcoded values.
Before 1.1.08, this was an interface. Changing to a class allowed adding
methods such as resName(int)
.
SOCResourceSet
Field Summary | |
---|---|
static int |
CLAY
Warning: Don't mess with these constants, other pieces of code depend on these numbers staying like this. |
static int |
CLOTH_STOLEN_LOCAL
Some code, internal to the soc.game or soc.server packages, uses this value (7) to represent stolen cloth ( SOCPlayer.getCloth() )
for scenario game option _SC_CLVI . |
static int |
GOLD_LOCAL
Some code, internal to the soc.game or soc.robot packages, uses this value (6) to represent SOCBoardLarge.GOLD_HEX tiles;
same numeric value as UNKNOWN . |
static int |
MAXPLUSONE
One past maximum value (7; max value is 6 == UNKNOWN ) |
static int |
MIN
Minimum value (1 == CLAY ) |
static int |
ORE
|
static int |
SHEEP
|
static int |
UNKNOWN
Unknown resource type (6). |
static int |
WHEAT
|
static int |
WOOD
|
Constructor Summary | |
---|---|
SOCResourceConstants()
|
Method Summary | |
---|---|
static java.lang.String |
aResName(int rtype)
Get the indefinite article of the resource type name for this number, such as "a clay" or "an ore". |
static java.lang.String |
resName(int rtype)
Get the resource type name for this resource type number, such as "clay" or "ore". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CLAY
CLAY
is first (1), WOOD
is last (5), UNKNOWN
is after wood.
Some code also takes advantage that CLAY
== SOCBoard.CLAY_HEX
,
SHEEP
== SOCBoard.SHEEP_HEX
, etc.
MIN
,
Constant Field Valuespublic static final int ORE
public static final int SHEEP
public static final int WHEAT
public static final int WOOD
public static final int UNKNOWN
WOOD
(5).
Sometimes also used as a "MAX+1" for array sizing
for per-resource-type arrays that contain CLAY
through WOOD
but don't contain UNKNOWN.
Same numeric value as GOLD_LOCAL
.
MAXPLUSONE
,
Constant Field Valuespublic static final int GOLD_LOCAL
SOCBoardLarge.GOLD_HEX
tiles;
same numeric value as UNKNOWN
. Occurs after WOOD
(5).
Gold is not a resource, and GOLD_LOCAL should not be sent over the network or used externally.
public static final int CLOTH_STOLEN_LOCAL
SOCPlayer.getCloth()
)
for scenario game option _SC_CLVI
.
Cloth is not a resource, and CLOTH_STOLEN_LOCAL should not be sent
over the network or used for anything except internally reporting stolen cloth.
So, this value can be changed between versions.
Numerically higher than GOLD_LOCAL
.
public static final int MIN
CLAY
)
public static final int MAXPLUSONE
UNKNOWN
)
Constructor Detail |
---|
public SOCResourceConstants()
Method Detail |
---|
public static java.lang.String resName(int rtype)
rtype
- Resource type, such as CLAY
or WOOD
.
UNKNOWN
/ GOLD_LOCAL
is out of range.
public static java.lang.String aResName(int rtype)
rtype
- Resource type, such as CLAY
or SHEEP
.
null
if rtype is out of range
(CLAY
- WOOD
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |