diff --git a/src/java/com/threerings/parlor/game/GameController.java b/src/java/com/threerings/parlor/game/GameController.java index 378ffe9bd..41429d37d 100644 --- a/src/java/com/threerings/parlor/game/GameController.java +++ b/src/java/com/threerings/parlor/game/GameController.java @@ -1,5 +1,5 @@ // -// $Id: GameController.java,v 1.15 2002/06/03 21:08:57 shaper Exp $ +// $Id: GameController.java,v 1.16 2002/06/12 07:59:18 shaper Exp $ package com.threerings.parlor.game; @@ -123,9 +123,6 @@ public abstract class GameController extends PlaceController // end the game until we receive a new board setGameOver(true); - - // increment the round identifier - _roundId++; } /** @@ -133,7 +130,7 @@ public abstract class GameController extends PlaceController */ public int getRoundId () { - return _roundId; + return _gobj.roundId; } /** @@ -241,9 +238,6 @@ public abstract class GameController extends PlaceController * controlling. */ protected GameObject _gobj; - /** The unique round identifier for the current round. */ - protected int _roundId; - /** A local flag overriding the game over state for situations where * the client knows the game is over before the server has * transitioned the game object accordingly. */ diff --git a/src/java/com/threerings/parlor/game/GameManager.java b/src/java/com/threerings/parlor/game/GameManager.java index 8f6c53947..55dd86903 100644 --- a/src/java/com/threerings/parlor/game/GameManager.java +++ b/src/java/com/threerings/parlor/game/GameManager.java @@ -1,5 +1,5 @@ // -// $Id: GameManager.java,v 1.33 2002/06/06 22:13:56 ray Exp $ +// $Id: GameManager.java,v 1.34 2002/06/12 07:59:19 shaper Exp $ package com.threerings.parlor.game; @@ -116,7 +116,7 @@ public class GameManager extends PlaceManager */ public int getRoundId () { - return _roundId; + return _gameobj.roundId; } /** @@ -375,7 +375,7 @@ public class GameManager extends PlaceManager gameWillReset(); // increment the round identifier - _roundId++; + _gameobj.setRoundId(_gameobj.roundId + 1); // do the standard game start processing gameWillStart(); @@ -496,9 +496,6 @@ public class GameManager extends PlaceManager /** The oids of our player and AI body objects. */ protected int[] _playerOids; - /** The unique round identifier for the current round. */ - protected int _roundId; - /** If AIs are present, contains their skill levels, or -1 at human * player indexes. */ protected byte[] _AIs; diff --git a/src/java/com/threerings/parlor/game/GameObject.dobj b/src/java/com/threerings/parlor/game/GameObject.dobj index c002c760d..d3b75d396 100644 --- a/src/java/com/threerings/parlor/game/GameObject.dobj +++ b/src/java/com/threerings/parlor/game/GameObject.dobj @@ -1,5 +1,5 @@ // -// $Id: GameObject.dobj,v 1.8 2002/02/13 03:21:28 mdb Exp $ +// $Id: GameObject.dobj,v 1.9 2002/06/12 07:59:19 shaper Exp $ package com.threerings.parlor.game; @@ -40,4 +40,7 @@ public class GameObject extends PlaceObject /** The username of the players involved in this game. */ public String[] players; + + /** The unique round identifier for the current round. */ + public int roundId; } diff --git a/src/java/com/threerings/parlor/game/GameObject.java b/src/java/com/threerings/parlor/game/GameObject.java index a7085e36f..d4bbd7eac 100644 --- a/src/java/com/threerings/parlor/game/GameObject.java +++ b/src/java/com/threerings/parlor/game/GameObject.java @@ -1,5 +1,5 @@ // -// $Id: GameObject.java,v 1.3 2002/02/20 23:35:42 mdb Exp $ +// $Id: GameObject.java,v 1.4 2002/06/12 07:59:19 shaper Exp $ package com.threerings.parlor.game; @@ -27,6 +27,9 @@ public class GameObject extends PlaceObject /** The field name of the players field. */ public static final String PLAYERS = "players"; + /** The field name of the roundId field. */ + public static final String ROUND_ID = "roundId"; + /** 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; @@ -50,6 +53,9 @@ public class GameObject extends PlaceObject /** The username of the players involved in this game. */ public String[] players; + /** The unique round identifier for the current round. */ + public int roundId; + /** * Requests that the state field be set to the specified * value. The local value will be updated immediately and an event @@ -91,4 +97,32 @@ public class GameObject extends PlaceObject this.players = players; requestAttributeChange(PLAYERS, players); } + + /** + * Requests that the indexth element of + * players field be set to the specified value. The local + * value will be updated immediately and an event will be propagated + * through the system to notify all listeners that the attribute did + * change. Proxied copies of this object (on clients) will apply the + * value change when they received the attribute changed notification. + */ + public void setPlayersAt (String value, int index) + { + this.players[index] = value; + requestElementUpdate(PLAYERS, value, index); + } + + /** + * Requests that the roundId field be set to the specified + * value. The local value will be updated immediately and an event + * will be propagated through the system to notify all listeners that + * the attribute did change. Proxied copies of this object (on + * clients) will apply the value change when they received the + * attribute changed notification. + */ + public void setRoundId (int roundId) + { + this.roundId = roundId; + requestAttributeChange(ROUND_ID, new Integer(roundId)); + } }