Added code to track a username to body object mapping for all users with

active sessions (even if they are currently disconnected).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@178 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-04 01:55:41 +00:00
parent 7688865b96
commit d2d9de37c1
2 changed files with 50 additions and 2 deletions
@@ -1,9 +1,10 @@
//
// $Id: CrowdServer.java,v 1.4 2001/08/03 02:28:20 mdb Exp $
// $Id: CrowdServer.java,v 1.5 2001/08/04 01:55:41 mdb Exp $
package com.threerings.cocktail.party.server;
import java.io.IOException;
import java.util.HashMap;
import com.threerings.cocktail.cher.server.CherServer;
@@ -49,6 +50,34 @@ public class PartyServer extends CherServer
Log.info("Party server initialized.");
}
/**
* The party server maintains a mapping of username to body object for
* all active users on the server. This should only be called from the
* dobjmgr thread.
*/
public static BodyObject lookupBody (String username)
{
return (BodyObject)_bodymap.get(username);
}
/**
* Called by the party client to map a username to a particular body
* object. This should only be called from the dobjmgr thread.
*/
protected static void mapBody (String username, BodyObject bodobj)
{
_bodymap.put(username, bodobj);
}
/**
* Called by the party client to unmap a username from a particular
* body object. This should only be called from the dobjmgr thread.
*/
protected static void unmapBody (String username)
{
_bodymap.remove(username);
}
public static void main (String[] args)
{
PartyServer server = new PartyServer();
@@ -61,6 +90,9 @@ public class PartyServer extends CherServer
}
}
/** We use this to map usernames to body objects. */
protected static HashMap _bodymap = new HashMap();
// the path to the config file
protected final static String CONFIG_PATH =
"rsrc/config/cocktail/party/server";