Let's be using the same code to enter a scene.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2067 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-12-14 01:51:00 +00:00
parent 1c4503efe5
commit aeab40a411
2 changed files with 35 additions and 41 deletions
@@ -1,5 +1,5 @@
//
// $Id: SceneProvider.java,v 1.13 2002/12/03 06:58:57 mdb Exp $
// $Id: SceneProvider.java,v 1.14 2002/12/14 01:51:00 mdb Exp $
package com.threerings.whirled.server;
@@ -76,31 +76,42 @@ public class SceneProvider
BodyObject source, SceneManager scmgr, int sceneVersion,
SceneMoveListener listener)
{
// move to the place object associated with this scene
PlaceObject plobj = scmgr.getPlaceObject();
int ploid = plobj.getOid();
try {
// try doing the actual move
PlaceConfig config = _locprov.moveTo(source, ploid);
// now that we've finally moved, we can update the user object
// with the new scene id
((ScenedBodyObject)source).setSceneId(scmgr.getScene().getId());
// check to see if they need a newer version of the scene data
SceneModel model = scmgr.getSceneModel();
if (sceneVersion < model.version) {
listener.moveSucceededPlusUpdate(ploid, config, model);
} else {
listener.moveSucceeded(ploid, config);
}
effectSceneMove(source, scmgr, sceneVersion, listener);
} catch (InvocationException sfe) {
listener.requestFailed(sfe.getMessage());
}
}
/**
* Moves the supplied body into the supplied (already resolved) scene
* and informs the supplied listener if the move is successfuly.
*
* @exception InvocationException thrown if a failure occurs
* attempting to move the user into the place associated with the
* scene.
*/
public void effectSceneMove (BodyObject source, SceneManager scmgr,
int sceneVersion, SceneMoveListener listener)
throws InvocationException
{
// move to the place object associated with this scene
int ploid = scmgr.getPlaceObject().getOid();
PlaceConfig config = _locprov.moveTo(source, ploid);
// now that we've finally moved, we can update the user object
// with the new scene id
((ScenedBodyObject)source).setSceneId(scmgr.getScene().getId());
// check to see if they need a newer version of the scene data
SceneModel model = scmgr.getSceneModel();
if (sceneVersion < model.version) {
listener.moveSucceededPlusUpdate(ploid, config, model);
} else {
listener.moveSucceeded(ploid, config);
}
}
/**
* Ejects the specified body from their current scene and sends them a
* request to move to the specified new scene. This is the
@@ -1,5 +1,5 @@
//
// $Id: SpotProvider.java,v 1.13 2002/08/14 19:07:58 mdb Exp $
// $Id: SpotProvider.java,v 1.14 2002/12/14 01:51:00 mdb Exp $
package com.threerings.whirled.spot.server;
@@ -122,32 +122,15 @@ public class SpotProvider
BodyObject source, SpotSceneManager scmgr, int sceneVer,
int exitPortalId, int destLocId, SceneMoveListener listener)
{
// move to the place object associated with this scene
PlaceObject plobj = scmgr.getPlaceObject();
int ploid = plobj.getOid();
int bodyOid = source.getOid();
// let the destination scene manager know that we're coming in
int bodyOid = source.getOid();
scmgr.mapEnteringBody(bodyOid, destLocId);
try {
// try doing the actual move
PlaceConfig config = _plreg.locprov.moveTo(source, ploid);
// check to see if they need a newer version of the scene data
SceneModel model = scmgr.getSceneModel();
if (sceneVer < model.version) {
// then send the moveTo response
listener.moveSucceededPlusUpdate(ploid, config, model);
} else {
// then send the moveTo response
listener.moveSucceeded(ploid, config);
}
// move to the place object associated with this scene
_screg.sceneprov.effectSceneMove(source, scmgr, sceneVer, listener);
} catch (InvocationException sfe) {
listener.requestFailed(sfe.getMessage());
// and let the destination scene manager know that we're no
// longer coming in
scmgr.clearEnteringBody(bodyOid);