|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.util.SOCGameBoardReset
public class SOCGameBoardReset
This class holds data the server needs, related to a "board reset" of a game being played.
If the SOCGame is in state SOCGame.READY_RESET_WAIT_ROBOT_DISMISS
,
this object is referenced within the newly created game object.
SOCGameListAtServer.resetBoard(String)
,
SOCGame.resetAsCopy()
,
SOCGame.boardResetOngoingInfo
Field Summary | |
---|---|
boolean |
hadRobots
Were there robots in the old game? |
StringConnection[] |
humanConns
Human and robot connections; both arrays null at vacant seats. |
SOCGame |
newGame
The new game, created from an old game by SOCGame.resetAsCopy() |
int |
oldGameState
gamestate of old game at reset time |
int |
oldRobotCount
Are we still waiting for robots to leave the old game? |
StringConnection[] |
robotConns
Human and robot connections; both arrays null at vacant seats. |
boolean[] |
wasRobot
Was this player position a robot? Indexed 0 to SOCGame.MAXPLAYERS-1 |
Constructor Summary | |
---|---|
SOCGameBoardReset(SOCGame oldGame,
java.util.Vector<StringConnection> memberConns)
Create a SOCGameReset: Extract data, reset the old game, and gather new data. |
Method Summary | |
---|---|
static int |
sortPlayerConnections(SOCGame newGame,
SOCGame oldGame,
java.util.Vector<StringConnection> memberConns,
StringConnection[] humanConns,
StringConnection[] robotConns)
Grab connection information for this game's humans and robots. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public SOCGame newGame
SOCGame.resetAsCopy()
public final int oldGameState
public boolean hadRobots
public int oldRobotCount
public StringConnection[] humanConns
SOCGame.resetAsCopy()
will duplicate human players
in the new game, but not robot players.
Indexed 0 to SOCGame.MAXPLAYERS-1
public StringConnection[] robotConns
SOCGame.resetAsCopy()
will duplicate human players
in the new game, but not robot players.
Indexed 0 to SOCGame.MAXPLAYERS-1
public boolean[] wasRobot
Constructor Detail |
---|
public SOCGameBoardReset(SOCGame oldGame, java.util.Vector<StringConnection> memberConns)
SOCGame.READY_RESET_WAIT_ROBOT_DISMISS
.
oldGame
- Game to reset - SOCGame.resetAsCopy()
will be called. The old game's state will be changed to RESET_OLD.memberConns
- Game members (StringConnections),
as retrieved by SOCGameListAtServer.getMembers(String)
.
Contents of this vector will be changed to remove any robot members.Method Detail |
---|
public static int sortPlayerConnections(SOCGame newGame, SOCGame oldGame, java.util.Vector<StringConnection> memberConns, StringConnection[] humanConns, StringConnection[] robotConns)
Two modes:
If currently copying a game, assumes newGame is from oldGame via SOCGame.resetAsCopy()
,
and newGame contains only the human players, oldGame contains all human and robot players.
If not copying a game, only inspecting one, then oldGame is null, and assumes newGame has all players (both human and robot).
newGame
- New game (if resetting), or only gameoldGame
- Old game (if resetting), or nullmemberConns
- Members of old game, from SOCGameListAtServer.getMembers(String)
; a Vector of StringConnectionshumanConns
- New array to fill with human players; indexed 0 to SOCGame.MAXPLAYERS-1.
humanConns[pn] will be the human player at position pn, or null.robotConns
- New array to fill with robot players; indexed 0 to SOCGame.MAXPLAYERS-1.
robotConns[pn] will be the robot player at position pn, or null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |