Created an extensible mechanism for clearing out a client's location
information when they end their session. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2014 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: CrowdClient.java,v 1.18 2002/12/02 23:18:06 mdb Exp $
|
||||
// $Id: CrowdClient.java,v 1.19 2002/12/03 06:58:57 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.server;
|
||||
|
||||
@@ -47,9 +47,21 @@ public class CrowdClient extends PresentsClient
|
||||
// clear out our location so that anyone listening for such things
|
||||
// will know that we've left
|
||||
if (_clobj != null) {
|
||||
CrowdServer.plreg.locprov.leaveOccupiedPlace((BodyObject)_clobj);
|
||||
clearLocation((BodyObject)_clobj);
|
||||
}
|
||||
|
||||
super.sessionDidEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* When the user ends their session, this method is called to clear
|
||||
* out any location they might occupy. The default implementation
|
||||
* takes care of standard crowd location occupancy, but users of other
|
||||
* services may which to override this method and clear the user out
|
||||
* of a scene, zone or other location-derived occupancy.
|
||||
*/
|
||||
protected void clearLocation (BodyObject bobj)
|
||||
{
|
||||
CrowdServer.plreg.locprov.leaveOccupiedPlace(bobj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneProvider.java,v 1.12 2002/09/20 00:54:06 mdb Exp $
|
||||
// $Id: SceneProvider.java,v 1.13 2002/12/03 06:58:57 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
@@ -115,6 +115,20 @@ public class SceneProvider
|
||||
SceneSender.forcedMove(source, sceneId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ejects the specified body from their current scene and zone. This
|
||||
* is the zone equivalent to {@link
|
||||
* LocationProvider#leaveOccupiedPlace}.
|
||||
*/
|
||||
public void leaveOccupiedScene (ScenedBodyObject source)
|
||||
{
|
||||
// remove them from their occupied place
|
||||
_locprov.leaveOccupiedPlace((BodyObject)source);
|
||||
|
||||
// and clear out their scene information
|
||||
source.setSceneId(-1);
|
||||
}
|
||||
|
||||
/** The location provider we use to handle low-level location stuff. */
|
||||
protected LocationProvider _locprov;
|
||||
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
//
|
||||
// $Id: WhirledClient.java,v 1.1 2001/12/03 22:07:31 mdb Exp $
|
||||
// $Id: WhirledClient.java,v 1.2 2002/12/03 06:58:57 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.server;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
import com.threerings.crowd.server.CrowdClient;
|
||||
|
||||
import com.threerings.whirled.data.ScenedBodyObject;
|
||||
|
||||
/**
|
||||
* The client object used by client management on the Whirled server.
|
||||
*/
|
||||
public class WhirledClient extends CrowdClient
|
||||
{
|
||||
// documentation inherited from interface
|
||||
protected void clearLocation (BodyObject bobj)
|
||||
{
|
||||
WhirledServer.screg.sceneprov.leaveOccupiedScene(
|
||||
(ScenedBodyObject)bobj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ZoneProvider.java,v 1.12 2002/10/04 01:33:10 mdb Exp $
|
||||
// $Id: ZoneProvider.java,v 1.13 2002/12/03 06:58:57 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.server;
|
||||
|
||||
@@ -185,13 +185,27 @@ public class ZoneProvider
|
||||
* request to move to the specified new zone and scene. This is the
|
||||
* zone-equivalent to {@link LocationProvider#moveBody}.
|
||||
*/
|
||||
public void moveBody (BodyObject source, int zoneId, int sceneId)
|
||||
public void moveBody (ZonedBodyObject source, int zoneId, int sceneId)
|
||||
{
|
||||
// first remove them from their old place
|
||||
_locprov.leaveOccupiedPlace(source);
|
||||
// first remove them from their old location
|
||||
leaveOccupiedZone(source);
|
||||
|
||||
// then send a forced move notification
|
||||
ZoneSender.forcedMove(source, zoneId, sceneId);
|
||||
ZoneSender.forcedMove((BodyObject)source, zoneId, sceneId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ejects the specified body from their current scene and zone. This
|
||||
* is the zone equivalent to {@link
|
||||
* LocationProvider#leaveOccupiedPlace}.
|
||||
*/
|
||||
public void leaveOccupiedZone (ZonedBodyObject source)
|
||||
{
|
||||
// remove them from their occupied scene
|
||||
_screg.sceneprov.leaveOccupiedScene(source);
|
||||
|
||||
// and clear out their zone information
|
||||
source.setZoneId(-1);
|
||||
}
|
||||
|
||||
/** The entity that handles basic location changes. */
|
||||
|
||||
Reference in New Issue
Block a user