Stick the players array in the game object; also implemented toString().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@467 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-10-17 02:48:57 +00:00
parent f863620d39
commit 9e6c104015
2 changed files with 33 additions and 7 deletions
@@ -1,8 +1,9 @@
//
// $Id: GameObject.dobj,v 1.4 2001/10/11 21:08:21 mdb Exp $
// $Id: GameObject.dobj,v 1.5 2001/10/17 02:48:57 mdb Exp $
package com.threerings.parlor.game;
import com.samskivert.util.StringUtil;
import com.threerings.crowd.data.PlaceObject;
/**
@@ -23,6 +24,9 @@ public class GameObject extends PlaceObject
/** The field name of the <code>isRated</code> field. */
public static final String IS_RATED = "isRated";
/** The field name of the <code>players</code> field. */
public static final String PLAYERS = "players";
/** A game state constant indicating that the game has not yet started
* and is still awaiting the arrival of all of the players. */
public static final int AWAITING_PLAYERS = 0;
@@ -43,6 +47,9 @@ public class GameObject extends PlaceObject
/** Indicates whether or not this game is rated. */
public boolean isRated;
/** The username of the players involved in this game. */
public String[] players;
/** Requests that the <code>state</code> field be set to the specified
* value. */
public void setState (int state)
@@ -56,4 +63,20 @@ public class GameObject extends PlaceObject
{
requestAttributeChange(IS_RATED, new Boolean(isRated));
}
/** Requests that the <code>players</code> field be set to the
* specified value. */
public void setPlayers (String[] value)
{
requestAttributeChange(PLAYERS, value);
}
// documentation inherited
protected void toString (StringBuffer buf)
{
super.toString(buf);
buf.append(", state=").append(state);
buf.append(", isRated=").append(isRated);
buf.append(", players=").append(StringUtil.toString(players));
}
}