soc.message
Class SOCDebugFreePlace

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

public class SOCDebugFreePlace
extends SOCMessage
implements SOCMessageForGame

This debug message from client to server means that a player is asking to place a piece on the board, without spending resources or checking the current player. The server will send SOCPutPiece in reply.

When sent from server to client, the message is a generic message to acknowledge that the "Free Placement" debug-mode has been turned on or off. getCoordinates() will return 1 for on, 0 for off.

Introduced in 1.1.12; check client version against VERSION_FOR_DEBUGFREEPLACE before sending this message.

Author:
Jeremy D Monin
See Also:
Serialized Form

Field Summary
private  int coordinates
          the coordinates of the piece
private  java.lang.String game
          the name of the game
private  int pieceType
          the type of piece being placed, such as SOCPlayingPiece.CITY
private  int playerNumber
          the player number of who played the piece
private static long serialVersionUID
          matches version (1.1.12)
static int VERSION_FOR_DEBUGFREEPLACE
          Minimum version (1.1.12) of client/server which recognize and send DEBUGFREEPLACE.
 
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
SOCDebugFreePlace(java.lang.String na, int pn, boolean onOff)
          create a DEBUGFREEPLACE message from the server.
SOCDebugFreePlace(java.lang.String na, int pn, int pt, int co)
          create a DEBUGFREEPLACE message from the client.
 
Method Summary
 int getCoordinates()
           
 java.lang.String getGame()
          Name of game this message is for.
 int getMinimumVersion()
          Minimum version where this message type is used.
 int getPieceType()
           
 int getPlayerNumber()
           
static SOCDebugFreePlace parseDataStr(java.lang.String s)
          parse the command string into a PutPiece message
 java.lang.String toCmd()
          Command string: DEBUGFREEPLACE sep game sep2 playerNumber sep2 pieceType sep2 coordinates
static java.lang.String toCmd(java.lang.String na, int pn, int pt, int co)
          Command string: DEBUGFREEPLACE sep game sep2 playerNumber sep2 pieceType sep2 coordinates
 java.lang.String toString()
          Simple human-readable representation, used for debug purposes.
 
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
matches version (1.1.12)

See Also:
Constant Field Values

VERSION_FOR_DEBUGFREEPLACE

public static final int VERSION_FOR_DEBUGFREEPLACE
Minimum version (1.1.12) of client/server which recognize and send DEBUGFREEPLACE.

See Also:
Constant Field Values

game

private java.lang.String game
the name of the game


pieceType

private int pieceType
the type of piece being placed, such as SOCPlayingPiece.CITY


playerNumber

private int playerNumber
the player number of who played the piece


coordinates

private int coordinates
the coordinates of the piece

Constructor Detail

SOCDebugFreePlace

public SOCDebugFreePlace(java.lang.String na,
                         int pn,
                         int pt,
                         int co)
create a DEBUGFREEPLACE message from the client.

Parameters:
na - name of the game
pt - type of playing piece, such as SOCPlayingPiece.CITY
pn - player number
co - coordinates

SOCDebugFreePlace

public SOCDebugFreePlace(java.lang.String na,
                         int pn,
                         boolean onOff)
create a DEBUGFREEPLACE message from the server. pieceType will be 0. coordinate will be 1 for on, 0 for off.

Parameters:
na - name of the game
pn - current player number
onOff - true for on, false for off
Method Detail

getGame

public java.lang.String getGame()
Description copied from interface: SOCMessageForGame
Name of game this message is for. Must not be null if message is in per-game structures or code.

At the server, the message treater dispatches incoming SOCMessageForGames based on their getGame():

Specified by:
getGame in interface SOCMessageForGame
Returns:
the name of the game
See Also:
SOCMessage.GAME_NONE

getPieceType

public int getPieceType()
Returns:
the type of playing piece, such as SOCPlayingPiece.CITY

getPlayerNumber

public int getPlayerNumber()
Returns:
the player number

getCoordinates

public int getCoordinates()
Returns:
the coordinates

toCmd

public java.lang.String toCmd()
Command string: DEBUGFREEPLACE sep game sep2 playerNumber sep2 pieceType sep2 coordinates

Specified by:
toCmd in class SOCMessage
Returns:
the command string

toCmd

public static java.lang.String toCmd(java.lang.String na,
                                     int pn,
                                     int pt,
                                     int co)
Command string: DEBUGFREEPLACE sep game sep2 playerNumber sep2 pieceType sep2 coordinates

Parameters:
na - the name of the game
pt - type of playing piece
pn - player number
co - coordinates
Returns:
the command string

parseDataStr

public static SOCDebugFreePlace parseDataStr(java.lang.String s)
parse the command string into a PutPiece message

Parameters:
s - the String to parse
Returns:
a TextMsg message, or null of the data is garbled

getMinimumVersion

public int getMinimumVersion()
Minimum version where this message type is used. DEBUGFREEPLACE introduced in 1.1.12 for debugging.

Overrides:
getMinimumVersion in class SOCMessage
Returns:
Version number, 1112 for JSettlers 1.1.12.
See Also:
VERSION_FOR_DEBUGFREEPLACE

toString

public java.lang.String toString()
Description copied from class: SOCMessage
Simple human-readable representation, used for debug purposes.

Specified by:
toString in class SOCMessage
Returns:
a human readable form of the message