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,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);
}
}