Changed service field to gameService; added code to clear out game service

registration when game goes away.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1726 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-09-20 04:53:42 +00:00
parent ed0693a8e7
commit 6c9c3d82f0
4 changed files with 23 additions and 14 deletions
@@ -1,5 +1,5 @@
// //
// $Id: GameController.java,v 1.19 2002/09/18 19:26:05 mdb Exp $ // $Id: GameController.java,v 1.20 2002/09/20 04:53:42 mdb Exp $
package com.threerings.parlor.game; package com.threerings.parlor.game;
@@ -77,7 +77,7 @@ public abstract class GameController extends PlaceController
_ctx.getClient().getInvoker().invokeLater(new Runnable() { _ctx.getClient().getInvoker().invokeLater(new Runnable() {
public void run () { public void run () {
// finally let the game manager know that we're ready to roll // finally let the game manager know that we're ready to roll
_gobj.service.playerReady(_ctx.getClient()); _gobj.gameService.playerReady(_ctx.getClient());
} }
}); });
} }
@@ -1,5 +1,5 @@
// //
// $Id: GameManager.java,v 1.42 2002/09/20 02:30:11 ray Exp $ // $Id: GameManager.java,v 1.43 2002/09/20 04:53:42 mdb Exp $
package com.threerings.parlor.game; package com.threerings.parlor.game;
@@ -296,7 +296,7 @@ public class GameManager extends PlaceManager
// create and fill in our game service object // create and fill in our game service object
GameMarshaller service = (GameMarshaller) GameMarshaller service = (GameMarshaller)
_invmgr.registerDispatcher(new GameDispatcher(this), false); _invmgr.registerDispatcher(new GameDispatcher(this), false);
_gameobj.setService(service); _gameobj.setGameService(service);
// let the players of this game know that we're ready to roll (if // let the players of this game know that we're ready to roll (if
// we have a specific set of players) // we have a specific set of players)
@@ -319,6 +319,15 @@ public class GameManager extends PlaceManager
} }
} }
// documentation inherited
protected void didShutdown ()
{
super.didShutdown();
// clear out our service registration
_invmgr.clearDispatcher(_gameobj.gameService);
}
// documentation inherited // documentation inherited
protected void bodyLeft (int bodyOid) protected void bodyLeft (int bodyOid)
{ {
@@ -1,5 +1,5 @@
// //
// $Id: GameObject.dobj,v 1.13 2002/09/18 18:33:20 mdb Exp $ // $Id: GameObject.dobj,v 1.14 2002/09/20 04:53:42 mdb Exp $
package com.threerings.parlor.game; package com.threerings.parlor.game;
@@ -34,7 +34,7 @@ public class GameObject extends PlaceObject
public static final int CANCELLED = 3; public static final int CANCELLED = 3;
/** Provides general game invocation services. */ /** Provides general game invocation services. */
public GameMarshaller service; public GameMarshaller gameService;
/** The game state, one of {@link #AWAITING_PLAYERS}, {@link #IN_PLAY}, /** The game state, one of {@link #AWAITING_PLAYERS}, {@link #IN_PLAY},
* {@link #GAME_OVER}, or {@link #CANCELLED}. */ * {@link #GAME_OVER}, or {@link #CANCELLED}. */
@@ -1,5 +1,5 @@
// //
// $Id: GameObject.java,v 1.8 2002/09/18 18:33:20 mdb Exp $ // $Id: GameObject.java,v 1.9 2002/09/20 04:53:42 mdb Exp $
package com.threerings.parlor.game; package com.threerings.parlor.game;
@@ -20,8 +20,8 @@ import com.threerings.crowd.data.PlaceObject;
*/ */
public class GameObject extends PlaceObject public class GameObject extends PlaceObject
{ {
/** The field name of the <code>service</code> field. */ /** The field name of the <code>gameService</code> field. */
public static final String SERVICE = "service"; public static final String GAME_SERVICE = "gameService";
/** The field name of the <code>state</code> field. */ /** The field name of the <code>state</code> field. */
public static final String STATE = "state"; public static final String STATE = "state";
@@ -49,7 +49,7 @@ public class GameObject extends PlaceObject
public static final int CANCELLED = 3; public static final int CANCELLED = 3;
/** Provides general game invocation services. */ /** Provides general game invocation services. */
public GameMarshaller service; public GameMarshaller gameService;
/** The game state, one of {@link #AWAITING_PLAYERS}, {@link #IN_PLAY}, /** The game state, one of {@link #AWAITING_PLAYERS}, {@link #IN_PLAY},
* {@link #GAME_OVER}, or {@link #CANCELLED}. */ * {@link #GAME_OVER}, or {@link #CANCELLED}. */
@@ -84,17 +84,17 @@ public class GameObject extends PlaceObject
} }
/** /**
* Requests that the <code>service</code> field be set to the specified * Requests that the <code>gameService</code> field be set to the specified
* value. The local value will be updated immediately and an event * value. The local value will be updated immediately and an event
* will be propagated through the system to notify all listeners that * will be propagated through the system to notify all listeners that
* the attribute did change. Proxied copies of this object (on * the attribute did change. Proxied copies of this object (on
* clients) will apply the value change when they received the * clients) will apply the value change when they received the
* attribute changed notification. * attribute changed notification.
*/ */
public void setService (GameMarshaller service) public void setGameService (GameMarshaller gameService)
{ {
this.service = service; this.gameService = gameService;
requestAttributeChange(SERVICE, service); requestAttributeChange(GAME_SERVICE, gameService);
} }
/** /**