Modified simulator manager to obtain helper managers at construct time
rather than referencing them through SimulatorServer. This is step on in eliminating SimulatorServer. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@930 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SimulatorManager.java,v 1.4 2001/12/20 01:11:18 shaper Exp $
|
// $Id: SimulatorManager.java,v 1.5 2002/02/05 20:27:07 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.micasa.simulator.server;
|
package com.threerings.micasa.simulator.server;
|
||||||
|
|
||||||
@@ -10,6 +10,9 @@ import com.samskivert.util.Config;
|
|||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.dobj.ObjectAccessException;
|
import com.threerings.presents.dobj.ObjectAccessException;
|
||||||
import com.threerings.presents.dobj.Subscriber;
|
import com.threerings.presents.dobj.Subscriber;
|
||||||
|
import com.threerings.presents.dobj.RootDObjectManager;
|
||||||
|
|
||||||
|
import com.threerings.presents.server.ClientManager;
|
||||||
import com.threerings.presents.server.InvocationManager;
|
import com.threerings.presents.server.InvocationManager;
|
||||||
import com.threerings.presents.server.InvocationProvider;
|
import com.threerings.presents.server.InvocationProvider;
|
||||||
|
|
||||||
@@ -44,11 +47,18 @@ public class SimulatorManager
|
|||||||
* @param invmgr a reference to the invocation manager in use by this
|
* @param invmgr a reference to the invocation manager in use by this
|
||||||
* server.
|
* server.
|
||||||
*/
|
*/
|
||||||
public void init (Config config, InvocationManager invmgr)
|
public void init (Config config, InvocationManager invmgr,
|
||||||
|
PlaceRegistry plreg, ClientManager clmgr,
|
||||||
|
RootDObjectManager omgr)
|
||||||
{
|
{
|
||||||
// register our simulator provider
|
// register our simulator provider
|
||||||
SimulatorProvider sprov = new SimulatorProvider(this);
|
SimulatorProvider sprov = new SimulatorProvider(this);
|
||||||
invmgr.registerProvider(MODULE_NAME, sprov);
|
invmgr.registerProvider(MODULE_NAME, sprov);
|
||||||
|
|
||||||
|
// keep these for later
|
||||||
|
_plreg = plreg;
|
||||||
|
_clmgr = clmgr;
|
||||||
|
_omgr = omgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +71,7 @@ public class SimulatorManager
|
|||||||
new CreateGameTask(source, config, simClass, playerCount);
|
new CreateGameTask(source, config, simClass, playerCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CreateGameTask implements CreationObserver
|
public class CreateGameTask implements CreationObserver
|
||||||
{
|
{
|
||||||
public CreateGameTask (
|
public CreateGameTask (
|
||||||
BodyObject source, GameConfig config, String simClass,
|
BodyObject source, GameConfig config, String simClass,
|
||||||
@@ -83,8 +93,7 @@ public class SimulatorManager
|
|||||||
// we needn't hang around and wait for game object
|
// we needn't hang around and wait for game object
|
||||||
// creation if it's just us
|
// creation if it's just us
|
||||||
CreationObserver obs = (_playerCount == 1) ? null : this;
|
CreationObserver obs = (_playerCount == 1) ? null : this;
|
||||||
_gmgr = (GameManager)
|
_gmgr = (GameManager)_plreg.createPlace(config, obs);
|
||||||
SimulatorServer.plreg.createPlace(config, obs);
|
|
||||||
|
|
||||||
// give the game manager the player names
|
// give the game manager the player names
|
||||||
String[] names = new String[_playerCount];
|
String[] names = new String[_playerCount];
|
||||||
@@ -136,9 +145,9 @@ public class SimulatorManager
|
|||||||
};
|
};
|
||||||
|
|
||||||
// fire off simulant body object creation requests
|
// fire off simulant body object creation requests
|
||||||
Class simobjClass = SimulatorServer.clmgr.getClientObjectClass();
|
Class simobjClass = _clmgr.getClientObjectClass();
|
||||||
for (int ii = 1; ii < _playerCount; ii++) {
|
for (int ii = 1; ii < _playerCount; ii++) {
|
||||||
SimulatorServer.omgr.createObject(simobjClass, sub);
|
_omgr.createObject(simobjClass, sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,4 +209,9 @@ public class SimulatorManager
|
|||||||
/** The body object of the player requesting the game creation. */
|
/** The body object of the player requesting the game creation. */
|
||||||
protected BodyObject _source;
|
protected BodyObject _source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// needed for general operation
|
||||||
|
protected PlaceRegistry _plreg;
|
||||||
|
protected ClientManager _clmgr;
|
||||||
|
protected RootDObjectManager _omgr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SimulatorServer.java,v 1.3 2001/12/20 01:11:18 shaper Exp $
|
// $Id: SimulatorServer.java,v 1.4 2002/02/05 20:27:07 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.micasa.simulator.server;
|
package com.threerings.micasa.simulator.server;
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ public class SimulatorServer extends CrowdServer
|
|||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
// initialize the manager
|
// initialize the manager
|
||||||
simmgr.init(config, invmgr);
|
simmgr.init(config, invmgr, plreg, clmgr, omgr);
|
||||||
|
|
||||||
Log.info("Simulator server initialized.");
|
Log.info("Simulator server initialized.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user