Track a user's connection status in their occupant info so that we can
react to player disconnection, idle (implementation still pending), and reconnection appropriately. Added PlaceManager.bodyUpdated(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1831 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,16 +1,63 @@
|
||||
//
|
||||
// $Id: CrowdClient.java,v 1.10 2002/09/19 23:36:59 mdb Exp $
|
||||
// $Id: CrowdClient.java,v 1.11 2002/10/26 02:40:30 shaper Exp $
|
||||
|
||||
package com.threerings.crowd.server;
|
||||
|
||||
import com.threerings.presents.server.PresentsClient;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
import com.threerings.crowd.data.OccupantInfo;
|
||||
import com.threerings.crowd.data.PlaceObject;
|
||||
import com.threerings.crowd.server.CrowdServer;
|
||||
|
||||
/**
|
||||
* The crowd client extends the presents client but doesn't really do
|
||||
* anything at present. It exists mainly so that implementation systems
|
||||
* will extend it and ensure that we have the option of adding
|
||||
* functionality here in the future.
|
||||
* The crowd client extends the presents client with crowd-specific client
|
||||
* handling.
|
||||
*/
|
||||
public class CrowdClient extends PresentsClient
|
||||
{
|
||||
// documentation inherited
|
||||
protected void wasUnmapped ()
|
||||
{
|
||||
super.wasUnmapped();
|
||||
|
||||
if (_clobj != null) {
|
||||
BodyObject bobj = (BodyObject)_clobj;
|
||||
|
||||
// get the location the user is occupying
|
||||
PlaceObject plobj = (PlaceObject)
|
||||
CrowdServer.omgr.getObject(bobj.location);
|
||||
if (plobj != null) {
|
||||
// update their occupant info with their new connection
|
||||
// status
|
||||
OccupantInfo info = (OccupantInfo)plobj.occupantInfo.get(
|
||||
new Integer(bobj.getOid()));
|
||||
if (info != null) {
|
||||
info.status = OccupantInfo.DISCONNECTED;
|
||||
plobj.updateOccupantInfo(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected void sessionWillResume ()
|
||||
{
|
||||
super.sessionWillResume();
|
||||
|
||||
BodyObject bobj = (BodyObject)_clobj;
|
||||
|
||||
// get the location the user is occupying
|
||||
PlaceObject plobj = (PlaceObject)
|
||||
CrowdServer.omgr.getObject(bobj.location);
|
||||
if (plobj != null) {
|
||||
// update their occupant info with their new connection status
|
||||
OccupantInfo info = (OccupantInfo)plobj.occupantInfo.get(
|
||||
new Integer(bobj.getOid()));
|
||||
if (info != null) {
|
||||
info.status = OccupantInfo.ACTIVE;
|
||||
plobj.updateOccupantInfo(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user