soc.message
Class SOCGameOptionInfo

java.lang.Object
  extended by soc.message.SOCMessage
      extended by soc.message.SOCMessageMulti
          extended by soc.message.SOCMessageTemplateMs
              extended by soc.message.SOCGameOptionInfo
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, SOCMessageForGame

public class SOCGameOptionInfo
extends SOCMessageTemplateMs

Information on one available SOCGameOption game option. Reply from server to a client's GAMEOPTIONGETINFOS message. Provides the option's information, including default value and current value at the server for new games. In v2.0.00+ the option description can be localized for the client.

If the server doesn't know this option, the returned option type is SOCGameOption.OTYPE_UNKNOWN. If the client asks about an option too new for it to use, by sending the option name or GAMEOPTIONGETINFOS("-"), the server will respond with SOCGameOption.OTYPE_UNKNOWN.

Special case: If the client is asking for any new options, by sending GAMEOPTIONGETINFOS("-"), but there aren't any new options, server responds with OPTINFO_NO_MORE_OPTS, a GAMEOPTIONINFO named "-" with type OTYPE_UNKNOWN.

This message is for clients to find out about options which were introduced in versions newer than the client's version, but which may be applicable to their version or all versions.

Introduced in 1.1.07; check client version against SOCNewGameWithOptions.VERSION_FOR_NEWGAMEWITHOPTIONS before sending this message.

In v2.0.00 and newer, SOCScenario info is also synchronized with similar logic; see SOCScenarioInfo.

Robot clients don't need to know about or handle this message type, because they don't create or browse games.

Since:
1.1.07
Author:
Jeremy D Monin
See Also:
Serialized Form

Field Summary
protected static java.lang.String EMPTYSTR
          symbol to represent a null or empty string value, because empty pa[] elements can't be parsed
protected  SOCGameOption opt
           
static SOCGameOptionInfo OPTINFO_NO_MORE_OPTS
          If the client is asking for any new options, by sending GAMEOPTIONGETINFOS("-"), server responds with set of GAMEOPTIONINFOs.
private static long serialVersionUID
           
 
Fields inherited from class soc.message.SOCMessageTemplateMs
game, pa
 
Fields inherited from class soc.message.SOCMessage
ACCEPTOFFER, ADMINPING, ADMINRESET, AUTHREQUEST, BANKTRADE, BCASTTEXTMSG, BOARDLAYOUT, BOARDLAYOUT2, BOARDSPECIALEDGE, BUILDREQUEST, BUYCARDREQUEST, CANCELBUILDREQUEST, CHANGEFACE, CHANNELS, CHOOSEPLAYER, CHOOSEPLAYERREQUEST, CLEAROFFER, CLEARTRADEMSG, CREATEACCOUNT, DEBUGFREEPLACE, DELETECHANNEL, DELETEGAME, DEVCARDACTION, DEVCARDCOUNT, DICERESULT, DICERESULTRESOURCES, DISCARD, DISCARDREQUEST, DISCOVERYPICK, ENDTURN, FIRSTPLAYER, GAME_NONE, GAMEMEMBERS, GAMEOPTIONGETDEFAULTS, GAMEOPTIONGETINFOS, GAMEOPTIONINFO, GAMES, GAMESERVERTEXT, GAMESTATE, GAMESTATS, GAMESWITHOPTIONS, GAMETEXTMSG, IMAROBOT, INVENTORYITEMACTION, JOIN, JOINAUTH, JOINGAME, JOINGAMEAUTH, LARGESTARMY, LASTSETTLEMENT, LEAVE, LEAVEALL, LEAVEGAME, LEGALEDGES, LOCALIZEDSTRINGS, LONGESTROAD, MAKEOFFER, MEMBERS, messageType, MONOPOLYPICK, MOVEPIECE, MOVEPIECEREQUEST, MOVEROBBER, NEWCHANNEL, NEWGAME, NEWGAMEWITHOPTIONS, NEWGAMEWITHOPTIONSREQUEST, NULLMESSAGE, PICKRESOURCES, PICKRESOURCESREQUEST, PIECEVALUE, PLAYDEVCARDREQUEST, PLAYERELEMENT, PLAYERELEMENTS, PLAYERSTATS, POTENTIALSETTLEMENTS, PUTPIECE, REJECTCONNECTION, REJECTOFFER, REMOVEPIECE, RESETBOARDAUTH, RESETBOARDREJECT, RESETBOARDREQUEST, RESETBOARDVOTE, RESETBOARDVOTEREQUEST, RESOURCECOUNT, REVEALFOGHEX, ROBOTDISMISS, ROBOTJOINGAMEREQUEST, ROLLDICE, ROLLDICEPROMPT, ROLLDICEREQUEST, SCENARIOINFO, sep, sep_char, sep2, sep2_char, SERVERPING, SETPLAYEDDEVCARD, SETSEATLOCK, SETSPECIALITEM, SETTURN, SETUPDONE, SIMPLEACTION, SIMPLEREQUEST, SITDOWN, STARTGAME, STATUSMESSAGE, SVPTEXTMSG, TEXTMSG, TIMINGPING, TURN, UPDATEROBOTPARAMS, VERSION
 
Constructor Summary
protected SOCGameOptionInfo(java.util.List<java.lang.String> pal)
          Constructor for client to parse server's reply about a game option.
  SOCGameOptionInfo(SOCGameOption op, int cliVers, java.lang.String localDesc)
          Constructor for server to tell client about a game option.
 
Method Summary
 int getMinimumVersion()
          Minimum version where this message type is used.
 SOCGameOption getOptionInfo()
           
 java.lang.String getOptionNameKey()
           
static SOCGameOptionInfo parseDataStr(java.util.List<java.lang.String> pa)
          Parse the command String array into a SOCGameOptionInfo message.
 
Methods inherited from class soc.message.SOCMessageTemplateMs
getGame, getParams, toCmd, toCmd, toString
 
Methods inherited from class soc.message.SOCMessage
arrayIntoStringBuf, enumIntoStringBuf, getClassNameShort, getMaximumVersion, 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

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

OPTINFO_NO_MORE_OPTS

public static final SOCGameOptionInfo OPTINFO_NO_MORE_OPTS
If the client is asking for any new options, by sending GAMEOPTIONGETINFOS("-"), server responds with set of GAMEOPTIONINFOs. Mark end of this list with a GAMEOPTIONINFO named "-" with type OTYPE_UNKNOWN.


EMPTYSTR

protected static final java.lang.String EMPTYSTR
symbol to represent a null or empty string value, because empty pa[] elements can't be parsed

See Also:
Constant Field Values

opt

protected SOCGameOption opt
Constructor Detail

SOCGameOptionInfo

public SOCGameOptionInfo(SOCGameOption op,
                         int cliVers,
                         java.lang.String localDesc)
Constructor for server to tell client about a game option. The client's version is checked to make sure the message format can be understood at the client, by omitting fields and flags added after the client's version.

Parameters:
op - Option to send
cliVers - Client's version number; 1107 is version 1.1.07
localDesc - i18n localized option description, or null to use SOCGameOption.getDesc()

SOCGameOptionInfo

protected SOCGameOptionInfo(java.util.List<java.lang.String> pal)
                     throws java.lang.IllegalArgumentException,
                            java.lang.NumberFormatException
Constructor for client to parse server's reply about a game option. If opt type number is unknown locally, will change to SOCGameOption.OTYPE_UNKNOWN.

Parameters:
pal - The option's parameters:
  • pal[0] = key (technical name of the option, from SOCVersionedItem.key)
  • pal[1] = type
  • pal[2] = minVersion
  • pal[3] = lastModVersion
  • pal[4] = defaultBoolValue ('t' or 'f')
  • pal[5] = defaultIntValue
  • pal[6] = minIntValue
  • pal[7] = maxIntValue
  • pal[8] = boolValue ('t' or 'f'; current, not default)
  • pal[9] = intValue (current, not default) or stringvalue
  • pal[10] = optFlags as integer -- before v2.0.00, only FLAG_DROP_IF_UNUSED ('t' or 'f')
  • pal[11] = desc (displayed text) if present; required for all types except OTYPE_UNKNOWN
  • pal[12] and beyond, if present = each enum choice's text
Throws:
java.lang.IllegalArgumentException - if pal's length < 11, or type is not a valid SOCGameOption.optType; if type isn't OTYPE_ENUM or ENUMBOOL, pal's length must == 12 (or 11 for OTYPE_UNKNOWN).
java.lang.NumberFormatException - if pal integer-field contents are incorrectly formatted.
Method Detail

getMinimumVersion

public int getMinimumVersion()
Minimum version where this message type is used. GAMEOPTIONINFO introduced in 1.1.07 for game-options feature.

Overrides:
getMinimumVersion in class SOCMessage
Returns:
Version number, 1107 for JSettlers 1.1.07.

getOptionNameKey

public java.lang.String getOptionNameKey()
Returns:
the name (key) of the option, or "-" for the end-of-list marker.

getOptionInfo

public SOCGameOption getOptionInfo()
Returns:
the parsed option values, or null if this message is coming from a client asking about a game

parseDataStr

public static SOCGameOptionInfo parseDataStr(java.util.List<java.lang.String> pa)
Parse the command String array into a SOCGameOptionInfo message.

Parameters:
pa - the String parameters
Returns:
a GameOptionInfo message, or null if parsing errors