//
// $Id: CrowdClient.java,v 1.16 2002/11/05 05:48:18 mdb Exp $

package com.threerings.crowd.server;

import com.threerings.presents.server.PresentsClient;

import com.threerings.crowd.Log;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.OccupantInfo;
import com.threerings.crowd.data.PlaceObject;

/**
 * The crowd client extends the presents client with crowd-specific client
 * handling.
 */
public class CrowdClient extends PresentsClient
{
    // documentation inherited
    protected void sessionConnectionClosed ()
    {
        super.sessionConnectionClosed();

        if (_clobj != null) {
            // note that the user's disconnected
            BodyObject bobj = (BodyObject)_clobj;
            BodyProvider.updateOccupantStatus(
                bobj, bobj.location, OccupantInfo.DISCONNECTED);
        }
    }

    // documentation inherited
    protected void sessionWillResume ()
    {
        super.sessionWillResume();

        // note that the user's active once more
        BodyObject bobj = (BodyObject)_clobj;
        BodyProvider.updateOccupantStatus(
            bobj, bobj.location, OccupantInfo.ACTIVE);
    }
}

//
// $Id: CrowdClient.java,v 1.17 2002/11/26 02:46:01 mdb Exp $

package com.threerings.crowd.server;

import com.threerings.presents.server.PresentsClient;

import com.threerings.crowd.Log;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.OccupantInfo;
import com.threerings.crowd.data.PlaceObject;

/**
 * The crowd client extends the presents client with crowd-specific client
 * handling.
 */
public class CrowdClient extends PresentsClient
{
    // documentation inherited
    protected void sessionConnectionClosed ()
    {
        super.sessionConnectionClosed();

        if (_clobj != null) {
            // note that the user's disconnected
            BodyObject bobj = (BodyObject)_clobj;
            BodyProvider.updateOccupantStatus(
                bobj, bobj.location, OccupantInfo.DISCONNECTED);
        }
    }

    // documentation inherited
    protected void sessionWillResume ()
    {
        super.sessionWillResume();

        // note that the user's active once more
        BodyObject bobj = (BodyObject)_clobj;
        BodyProvider.updateOccupantStatus(
            bobj, bobj.location, OccupantInfo.ACTIVE);
    }

    // documentation inherited
    protected void sessionDidEnd ()
    {
        // clear out our location so that anyone listening for such things
        // will know that we've left
        if (_clobj != null) {
            BodyObject bobj = (BodyObject)_clobj;
            bobj.setLocation(-1);
        }

        super.sessionDidEnd();
    }
}

Clear out our body's location when we log off because with the new client reference counting thing, we can't rely on a user's object being destroyed immediately after they log off. Better to ensure that their location will always be cleared so that location interested entities will be properly notified.
Clear out our body's location when we log off because with the new client
reference counting thing, we can't rely on a user's object being destroyed
immediately after they log off. Better to ensure that their location will
always be cleared so that location interested entities will be properly
notified.


git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@1991 542714f4-19e9-0310-aa3c-eee0fc999fb1
