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:
@@ -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;
|
package com.threerings.whirled.server;
|
||||||
|
|
||||||
@@ -76,31 +76,42 @@ public class SceneProvider
|
|||||||
BodyObject source, SceneManager scmgr, int sceneVersion,
|
BodyObject source, SceneManager scmgr, int sceneVersion,
|
||||||
SceneMoveListener listener)
|
SceneMoveListener listener)
|
||||||
{
|
{
|
||||||
// move to the place object associated with this scene
|
|
||||||
PlaceObject plobj = scmgr.getPlaceObject();
|
|
||||||
int ploid = plobj.getOid();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// try doing the actual move
|
effectSceneMove(source, scmgr, sceneVersion, listener);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (InvocationException sfe) {
|
} catch (InvocationException sfe) {
|
||||||
listener.requestFailed(sfe.getMessage());
|
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
|
* Ejects the specified body from their current scene and sends them a
|
||||||
* request to move to the specified new scene. This is the
|
* 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;
|
package com.threerings.whirled.spot.server;
|
||||||
|
|
||||||
@@ -122,32 +122,15 @@ public class SpotProvider
|
|||||||
BodyObject source, SpotSceneManager scmgr, int sceneVer,
|
BodyObject source, SpotSceneManager scmgr, int sceneVer,
|
||||||
int exitPortalId, int destLocId, SceneMoveListener listener)
|
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
|
// let the destination scene manager know that we're coming in
|
||||||
|
int bodyOid = source.getOid();
|
||||||
scmgr.mapEnteringBody(bodyOid, destLocId);
|
scmgr.mapEnteringBody(bodyOid, destLocId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// try doing the actual move
|
// move to the place object associated with this scene
|
||||||
PlaceConfig config = _plreg.locprov.moveTo(source, ploid);
|
_screg.sceneprov.effectSceneMove(source, scmgr, sceneVer, listener);
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (InvocationException sfe) {
|
} catch (InvocationException sfe) {
|
||||||
listener.requestFailed(sfe.getMessage());
|
listener.requestFailed(sfe.getMessage());
|
||||||
|
|
||||||
// and let the destination scene manager know that we're no
|
// and let the destination scene manager know that we're no
|
||||||
// longer coming in
|
// longer coming in
|
||||||
scmgr.clearEnteringBody(bodyOid);
|
scmgr.clearEnteringBody(bodyOid);
|
||||||
|
|||||||
Reference in New Issue
Block a user