Converted more dobj classes to use the gendobj script. (Had to do a wee

bit of fiddling to accomplish some things that used to be done by hand.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@973 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-08 23:55:25 +00:00
parent 05a8a19a12
commit 5581b3e65b
9 changed files with 272 additions and 76 deletions
@@ -1,10 +1,15 @@
//
// $Id: LobbyObject.dobj,v 1.3 2001/10/11 04:13:33 mdb Exp $
// $Id: LobbyObject.dobj,v 1.4 2002/02/08 23:55:24 mdb Exp $
package com.threerings.micasa.lobby;
import com.threerings.crowd.data.PlaceObject;
/**
* Presently the lobby object contains nothing specific, but the class
* acts as a placeholder in case lobby-wide fields are needed in the
* future.
*/
public class LobbyObject extends PlaceObject
{
}
@@ -0,0 +1,15 @@
//
// $Id: LobbyObject.java,v 1.1 2002/02/08 23:55:24 mdb Exp $
package com.threerings.micasa.lobby;
import com.threerings.crowd.data.PlaceObject;
/**
* Presently the lobby object contains nothing specific, but the class
* acts as a placeholder in case lobby-wide fields are needed in the
* future.
*/
public class LobbyObject extends PlaceObject
{
}
@@ -1,5 +1,5 @@
//
// $Id: TableListView.java,v 1.2 2001/10/23 23:52:01 mdb Exp $
// $Id: TableListView.java,v 1.3 2002/02/08 23:55:24 mdb Exp $
package com.threerings.micasa.lobby.table;
@@ -59,7 +59,7 @@ public class TableListView
_ctx = ctx;
// create our table director
_tdtr = new TableDirector(ctx, TableLobbyObject.TABLES, this);
_tdtr = new TableDirector(ctx, TableLobbyObject.TABLE_SET, this);
// add ourselves as a seatedness observer
_tdtr.addSeatednessObserver(this);
@@ -132,7 +132,7 @@ public class TableListView
// iterate over the tables already active in this lobby and put
// them in their respective lists
TableLobbyObject tlobj = (TableLobbyObject)place;
Iterator iter = tlobj.tables.elements();
Iterator iter = tlobj.tableSet.elements();
while (iter.hasNext()) {
tableAdded((Table)iter.next());
}
@@ -1,5 +1,5 @@
//
// $Id: TableLobbyObject.dobj,v 1.1 2001/10/23 20:24:10 mdb Exp $
// $Id: TableLobbyObject.dobj,v 1.2 2002/02/08 23:55:24 mdb Exp $
package com.threerings.micasa.lobby.table;
@@ -11,51 +11,30 @@ public class TableLobbyObject
extends LobbyObject
implements com.threerings.parlor.data.TableLobbyObject
{
/** The field name of the <code>tables</code> field. */
public static final String TABLES = "tables";
/** A set containing all of the tables being managed by this lobby. */
public DSet tables = new DSet(Table.class);
public DSet tableSet = new DSet(Table.class);
// documentation inherited
public DSet getTables ()
{
return tables;
return tableSet;
}
/**
* Requests that the <code>tables</code> field be set to the specified
* value.
*/
public void setTables (DSet value)
{
requestAttributeChange(TABLES, value);
}
/**
* Requests that the specified element be added to the
* <code>tables</code> set.
*/
// documentation inherited from interface
public void addToTables (Table table)
{
requestElementAdd(TABLES, table);
addToTableSet(table);
}
/**
* Requests that the specified element be updated in the
* <code>tables</code> set.
*/
// documentation inherited from interface
public void updateTables (Table table)
{
requestElementUpdate(TABLES, table);
updateTableSet(table);
}
/**
* Requests that the element matching the supplied key be removed from
* the <code>tables</code> set.
*/
// documentation inherited from interface
public void removeFromTables (Object key)
{
requestElementRemove(TABLES, key);
removeFromTableSet(key);
}
}
@@ -0,0 +1,81 @@
//
// $Id: TableLobbyObject.java,v 1.1 2002/02/08 23:55:24 mdb Exp $
package com.threerings.micasa.lobby.table;
import com.threerings.presents.dobj.DSet;
import com.threerings.parlor.data.Table;
import com.threerings.micasa.lobby.LobbyObject;
public class TableLobbyObject
extends LobbyObject
implements com.threerings.parlor.data.TableLobbyObject
{
/** The field name of the <code>tableSet</code> field. */
public static final String TABLE_SET = "tableSet";
/** A set containing all of the tables being managed by this lobby. */
public DSet tableSet = new DSet(Table.class);
// documentation inherited
public DSet getTables ()
{
return tableSet;
}
// documentation inherited from interface
public void addToTables (Table table)
{
addToTableSet(table);
}
// documentation inherited from interface
public void updateTables (Table table)
{
updateTableSet(table);
}
// documentation inherited from interface
public void removeFromTables (Object key)
{
removeFromTableSet(key);
}
/**
* Requests that the specified element be added to the
* <code>tableSet</code> set.
*/
public void addToTableSet (DSet.Element elem)
{
requestElementAdd(TABLE_SET, elem);
}
/**
* Requests that the element matching the supplied key be removed from
* the <code>tableSet</code> set.
*/
public void removeFromTableSet (Object key)
{
requestElementRemove(TABLE_SET, key);
}
/**
* Requests that the specified element be updated in the
* <code>tableSet</code> set.
*/
public void updateTableSet (DSet.Element elem)
{
requestElementUpdate(TABLE_SET, elem);
}
/**
* Requests that the <code>tableSet</code> field be set to the
* specified value. Generally one only adds, updates and removes
* elements of a distributed set, but certain situations call for a
* complete replacement of the set value.
*/
public void setTableSet (DSet value)
{
requestAttributeChange(TABLE_SET, value);
}
}
@@ -1,5 +1,5 @@
//
// $Id: GameObject.dobj,v 1.6 2002/02/04 01:47:20 mdb Exp $
// $Id: GameObject.dobj,v 1.7 2002/02/08 23:55:25 mdb Exp $
package com.threerings.parlor.game;
@@ -18,15 +18,6 @@ import com.threerings.crowd.data.PlaceObject;
*/
public class GameObject extends PlaceObject
{
/** The field name of the <code>state</code> field. */
public static final String STATE = "state";
/** 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;
@@ -49,25 +40,4 @@ public class GameObject extends PlaceObject
/** 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)
{
requestAttributeChange(STATE, new Integer(state));
}
/** Requests that the <code>isRated</code> field be set to the
* specified value. */
public void setIsRated (boolean isRated)
{
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);
}
}
@@ -0,0 +1,115 @@
//
// $Id: GameObject.java,v 1.1 2002/02/08 23:55:25 mdb Exp $
package com.threerings.parlor.game;
import com.samskivert.util.StringUtil;
import com.threerings.crowd.data.PlaceObject;
/**
* A game object hosts the shared data associated with a game played by
* one or more players. The game object extends the place object so that
* the game can act as a place where players actually go when playing the
* game. Only very basic information is maintained in the base game
* object. It serves as the base for a hierarchy of game object
* derivatives that handle basic gameplay for a suite of different game
* types (ie. turn based games, party games, board games, card games,
* etc.).
*/
public class GameObject extends PlaceObject
{
/** The field name of the <code>state</code> field. */
public static final String STATE = "state";
/** 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;
/** A game state constant indicating that the game is in play. */
public static final int IN_PLAY = 1;
/** A game state constant indicating that the game ended normally. */
public static final int GAME_OVER = 2;
/** A game state constant indicating that the game was cancelled. */
public static final int CANCELLED = 3;
/** The game state, one of {@link #AWAITING_PLAYERS}, {@link #IN_PLAY},
* {@link #GAME_OVER}, or {@link #CANCELLED}. */
public int state;
/** 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)
{
requestAttributeChange(STATE, new Integer(state));
}
/**
* Requests that the <code>state</code> field be set to the
* specified value and immediately updates the state of the object
* to reflect the change. This should <em>only</em> be called on the
* server and only then if you know what you're doing.
*/
public void setStateImmediate (int state)
{
this.state = state;
requestAttributeChange(STATE, new Integer(state));
}
/**
* Requests that the <code>isRated</code> field be set to the specified
* value.
*/
public void setIsRated (boolean isRated)
{
requestAttributeChange(IS_RATED, new Boolean(isRated));
}
/**
* Requests that the <code>isRated</code> field be set to the
* specified value and immediately updates the state of the object
* to reflect the change. This should <em>only</em> be called on the
* server and only then if you know what you're doing.
*/
public void setIsRatedImmediate (boolean isRated)
{
this.isRated = isRated;
requestAttributeChange(IS_RATED, new Boolean(isRated));
}
/**
* Requests that the <code>players</code> field be set to the specified
* value.
*/
public void setPlayers (String[] players)
{
requestAttributeChange(PLAYERS, players);
}
/**
* Requests that the <code>players</code> field be set to the
* specified value and immediately updates the state of the object
* to reflect the change. This should <em>only</em> be called on the
* server and only then if you know what you're doing.
*/
public void setPlayersImmediate (String[] players)
{
this.players = players;
requestAttributeChange(PLAYERS, players);
}
}
@@ -1,5 +1,5 @@
//
// $Id: TurnGameObject.dobj,v 1.3 2002/02/04 01:47:20 mdb Exp $
// $Id: TurnGameObject.dobj,v 1.4 2002/02/08 23:55:25 mdb Exp $
package com.threerings.parlor.turn;
@@ -10,18 +10,8 @@ import com.threerings.parlor.game.GameObject;
*/
public class TurnGameObject extends GameObject
{
/** The field name of the <code>turnHolder</code> field. */
public static final String TURN_HOLDER = "turnHolder";
/** The username of the player who is currently taking their turn in
* this turn-based game or null if no user currently holds the
* turn. */
public String turnHolder;
/** Requests that the <code>turnHolder</code> field be set to the
* specified value. */
public void setTurnHolder (String turnHolder)
{
requestAttributeChange(TURN_HOLDER, turnHolder);
}
}
@@ -0,0 +1,41 @@
//
// $Id: TurnGameObject.java,v 1.1 2002/02/08 23:55:25 mdb Exp $
package com.threerings.parlor.turn;
import com.threerings.parlor.game.GameObject;
/**
* Extends the basic game object with support for turn-based games.
*/
public class TurnGameObject extends GameObject
{
/** The field name of the <code>turnHolder</code> field. */
public static final String TURN_HOLDER = "turnHolder";
/** The username of the player who is currently taking their turn in
* this turn-based game or null if no user currently holds the
* turn. */
public String turnHolder;
/**
* Requests that the <code>turnHolder</code> field be set to the specified
* value.
*/
public void setTurnHolder (String turnHolder)
{
requestAttributeChange(TURN_HOLDER, turnHolder);
}
/**
* Requests that the <code>turnHolder</code> field be set to the
* specified value and immediately updates the state of the object
* to reflect the change. This should <em>only</em> be called on the
* server and only then if you know what you're doing.
*/
public void setTurnHolderImmediate (String turnHolder)
{
this.turnHolder = turnHolder;
requestAttributeChange(TURN_HOLDER, turnHolder);
}
}