add copy constructors; change starting game to two players, second a

robot.
This commit is contained in:
ehouse 2010-01-12 13:20:18 +00:00
parent 71fe75049b
commit 1a4f0e04bf
2 changed files with 26 additions and 4 deletions

View file

@ -26,15 +26,29 @@ public class CurGameInfo {
public boolean confirmBTConnect; /* only used for BT */ public boolean confirmBTConnect; /* only used for BT */
public CurGameInfo() { public CurGameInfo() {
nPlayers = 3; nPlayers = 2;
boardSize = 15; boardSize = 15;
players = new LocalPlayer[nPlayers]; players = new LocalPlayer[nPlayers];
serverRole = DeviceRole.SERVER_STANDALONE; serverRole = DeviceRole.SERVER_STANDALONE;
dictName = BUILTIN_DICT; dictName = BUILTIN_DICT;
hintsNotAllowed = false; hintsNotAllowed = false;
players[0] = new LocalPlayer( "Eric"); players[0] = new LocalPlayer( "Player 1");
players[1] = new LocalPlayer( "Kati", true ); players[1] = new LocalPlayer( "Player 2", true );
players[2] = new LocalPlayer( "Brynn", true );
} }
public CurGameInfo( CurGameInfo src ) {
nPlayers = src.nPlayers;
boardSize = src.boardSize;
players = new LocalPlayer[nPlayers];
serverRole = src.serverRole;
dictName = src.dictName;
hintsNotAllowed = src.hintsNotAllowed;
int ii;
for ( ii = 0; ii < nPlayers; ++ii ) {
players[ii] = new LocalPlayer( src.players[ii] );
}
}
} }

View file

@ -15,6 +15,14 @@ public class LocalPlayer {
password = ""; password = "";
} }
public LocalPlayer( LocalPlayer src ) {
isLocal = src.isLocal;
isRobot = src.isRobot;
name = src.name;
password = src.password;
secondsUsed = 0;
}
public LocalPlayer( String nm, boolean robot ) { public LocalPlayer( String nm, boolean robot ) {
this( nm ); this( nm );
isRobot = robot; isRobot = robot;