Keep the sceneId of the currently occupied scene in the body object.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1718 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-09-20 00:54:06 +00:00
parent ba4985053f
commit d8af715498
4 changed files with 42 additions and 7 deletions
@@ -0,0 +1,21 @@
//
// $Id: ScenedBodyObject.java,v 1.1 2002/09/20 00:54:06 mdb Exp $
package com.threerings.whirled.data;
/**
* A system that uses the whirled services must provide a body object
* extension that implements this interface.
*/
public interface ScenedBodyObject
{
/**
* Returns the scene id currently occupied by this body.
*/
public int getSceneId ();
/**
* Sets the scene id currently occupied by this body.
*/
public void setSceneId (int sceneId);
}
@@ -1,5 +1,5 @@
//
// $Id: SceneProvider.java,v 1.11 2002/08/14 19:07:57 mdb Exp $
// $Id: SceneProvider.java,v 1.12 2002/09/20 00:54:06 mdb Exp $
package com.threerings.whirled.server;
@@ -16,6 +16,7 @@ import com.threerings.whirled.Log;
import com.threerings.whirled.client.SceneService.SceneMoveListener;
import com.threerings.whirled.data.SceneCodes;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.data.ScenedBodyObject;
/**
* The scene provider handles the server side of the scene related
@@ -83,6 +84,10 @@ public class SceneProvider
// 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) {
@@ -1,13 +1,15 @@
//
// $Id: ZonedBodyObject.java,v 1.1 2001/12/04 00:31:58 mdb Exp $
// $Id: ZonedBodyObject.java,v 1.2 2002/09/20 00:54:06 mdb Exp $
package com.threerings.whirled.zone.data;
import com.threerings.whirled.data.ScenedBodyObject;
/**
* A system that uses the zone services must provide a body object
* extension that implements this interface.
*/
public interface ZonedBodyObject
public interface ZonedBodyObject extends ScenedBodyObject
{
/**
* Returns the zone id currently occupied by this body.
@@ -1,5 +1,5 @@
//
// $Id: ZoneProvider.java,v 1.10 2002/08/14 19:07:58 mdb Exp $
// $Id: ZoneProvider.java,v 1.11 2002/09/20 00:54:06 mdb Exp $
package com.threerings.whirled.zone.server;
@@ -13,8 +13,9 @@ import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.server.LocationProvider;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.server.SceneRegistry;
import com.threerings.whirled.data.ScenedBodyObject;
import com.threerings.whirled.server.SceneManager;
import com.threerings.whirled.server.SceneRegistry;
import com.threerings.whirled.zone.Log;
import com.threerings.whirled.zone.client.ZoneService.ZoneMoveListener;
@@ -150,8 +151,14 @@ public class ZoneProvider
PlaceConfig config = _locprov.moveTo(source, ploid);
// now that we've finally moved, we can update the user object
// with the new zone id
((ZonedBodyObject)source).setZoneId(summary.zoneId);
// with the new scene and zone ids
try {
source.startTransaction();
((ScenedBodyObject)source).setSceneId(scmgr.getScene().getId());
((ZonedBodyObject)source).setZoneId(summary.zoneId);
} finally {
source.commitTransaction();
}
// check to see if they need a newer version of the scene data
SceneModel model = scmgr.getSceneModel();