Map simulant body objects into the server on creation.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@843 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SimulatorManager.java,v 1.3 2001/12/19 23:30:47 shaper Exp $
|
// $Id: SimulatorManager.java,v 1.4 2001/12/20 01:11:18 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.micasa.simulator.server;
|
package com.threerings.micasa.simulator.server;
|
||||||
|
|
||||||
@@ -115,6 +115,9 @@ public class SimulatorManager
|
|||||||
BodyObject bobj = (BodyObject)object;
|
BodyObject bobj = (BodyObject)object;
|
||||||
bobj.username = "simulant" + (_sims.size() + 1);
|
bobj.username = "simulant" + (_sims.size() + 1);
|
||||||
|
|
||||||
|
// map the simulant into the server body set
|
||||||
|
SimulatorServer.mapBody(bobj.username, bobj);
|
||||||
|
|
||||||
// hold onto it for later game creation
|
// hold onto it for later game creation
|
||||||
_sims.add(bobj);
|
_sims.add(bobj);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
//
|
//
|
||||||
// $Id: SimulatorServer.java,v 1.2 2001/12/19 23:30:47 shaper Exp $
|
// $Id: SimulatorServer.java,v 1.3 2001/12/20 01:11:18 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.micasa.simulator.server;
|
package com.threerings.micasa.simulator.server;
|
||||||
|
|
||||||
|
import com.threerings.crowd.data.BodyObject;
|
||||||
import com.threerings.crowd.server.CrowdServer;
|
import com.threerings.crowd.server.CrowdServer;
|
||||||
|
|
||||||
import com.threerings.micasa.Log;
|
import com.threerings.micasa.Log;
|
||||||
@@ -31,6 +32,21 @@ public class SimulatorServer extends CrowdServer
|
|||||||
Log.info("Simulator server initialized.");
|
Log.info("Simulator server initialized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the simulator manager to map a username to a particular
|
||||||
|
* body object. This should only be called from the dobjmgr thread.
|
||||||
|
*
|
||||||
|
* <p> This is copied from {@link CrowdServer#mapBody} as that
|
||||||
|
* implementation is protected and cannot be referenced by classes in
|
||||||
|
* the simulator package, but we know what we're doing and so we
|
||||||
|
* knowingly expose this functionality to other classes in our
|
||||||
|
* package.
|
||||||
|
*/
|
||||||
|
protected static void mapBody (String username, BodyObject bodobj)
|
||||||
|
{
|
||||||
|
_bodymap.put(username, bodobj);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main (String[] args)
|
public static void main (String[] args)
|
||||||
{
|
{
|
||||||
SimulatorServer server = new SimulatorServer();
|
SimulatorServer server = new SimulatorServer();
|
||||||
|
|||||||
Reference in New Issue
Block a user