Added support for dispatching scene updates made to the currently occupied

scene.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2649 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-06-11 04:14:11 +00:00
parent 087f26b41b
commit 575337b429
7 changed files with 110 additions and 14 deletions
@@ -1,5 +1,5 @@
//
// $Id: Scene.java,v 1.8 2003/02/12 07:23:31 mdb Exp $
// $Id: Scene.java,v 1.9 2003/06/11 04:14:11 mdb Exp $
package com.threerings.whirled.data;
@@ -50,6 +50,14 @@ public interface Scene
*/
public void setVersion (int version);
/**
* Called to inform the scene that an update has been received while
* the scene was resolved and active. The update should be applied to
* the underlying scene model and any derivative data should be
* appropriately updated.
*/
public void updateReceived (SceneUpdate update);
/**
* Returns the scene model from which this scene was created.
*/
@@ -1,5 +1,5 @@
//
// $Id: SceneCodes.java,v 1.3 2002/08/14 19:07:57 mdb Exp $
// $Id: SceneCodes.java,v 1.4 2003/06/11 04:14:11 mdb Exp $
package com.threerings.whirled.data;
@@ -11,4 +11,6 @@ import com.threerings.whirled.client.SceneDirector;
*/
public interface SceneCodes extends LocationCodes
{
/** The message identifier for scene update messages. */
public static final String SCENE_UPDATE = "scene_update";
}
@@ -1,10 +1,11 @@
//
// $Id: SceneImpl.java,v 1.1 2003/02/12 07:23:31 mdb Exp $
// $Id: SceneImpl.java,v 1.2 2003/06/11 04:14:11 mdb Exp $
package com.threerings.whirled.data;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.Log;
/**
* An implementation of the {@link Scene} interface.
@@ -72,6 +73,20 @@ public class SceneImpl implements Scene
_model.version = version;
}
// documentation inherited from interface
public void updateReceived (SceneUpdate update)
{
try {
// validate and apply the update
update.validate(_model);
update.apply(_model);
} catch (Exception e) {
Log.warning("Error applying update [scene=" + this +
", update=" + update + "].");
Log.logStackTrace(e);
}
}
// documentation inherited from interface
public SceneModel getSceneModel ()
{