From 4a7792f4d644e73e6521c10821ac11e4ac27d21e Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 12 Dec 2001 19:06:15 +0000 Subject: [PATCH] Moved the scene name into the basic scene model from the editable scene model as we'll be having scene names in the runtime system. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@757 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../whirled/client/DisplayScene.java | 7 ++++- .../whirled/client/DisplaySceneImpl.java | 8 +++++- .../threerings/whirled/data/SceneModel.java | 9 ++++++- .../whirled/tools/EditableScene.java | 17 +++++------- .../whirled/tools/EditableSceneImpl.java | 26 +++++++++---------- .../whirled/tools/EditableSceneModel.java | 7 +---- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/java/com/threerings/whirled/client/DisplayScene.java b/src/java/com/threerings/whirled/client/DisplayScene.java index dd2cdb890..db46fc0b0 100644 --- a/src/java/com/threerings/whirled/client/DisplayScene.java +++ b/src/java/com/threerings/whirled/client/DisplayScene.java @@ -1,5 +1,5 @@ // -// $Id: DisplayScene.java,v 1.1 2001/11/12 20:56:55 mdb Exp $ +// $Id: DisplayScene.java,v 1.2 2001/12/12 19:06:15 mdb Exp $ package com.threerings.whirled.client; @@ -26,6 +26,11 @@ public interface DisplayScene */ public int getId (); + /** + * Returns the name of this scene. + */ + public String getName (); + /** * Returns the version number of this scene. */ diff --git a/src/java/com/threerings/whirled/client/DisplaySceneImpl.java b/src/java/com/threerings/whirled/client/DisplaySceneImpl.java index 448a10759..df288b7f8 100644 --- a/src/java/com/threerings/whirled/client/DisplaySceneImpl.java +++ b/src/java/com/threerings/whirled/client/DisplaySceneImpl.java @@ -1,5 +1,5 @@ // -// $Id: DisplaySceneImpl.java,v 1.1 2001/11/12 20:56:55 mdb Exp $ +// $Id: DisplaySceneImpl.java,v 1.2 2001/12/12 19:06:15 mdb Exp $ package com.threerings.whirled.client; @@ -28,6 +28,12 @@ public class DisplaySceneImpl implements DisplayScene return _model.sceneId; } + // documentation inherited + public String getName () + { + return _model.sceneName; + } + // documentation inherited public int getVersion () { diff --git a/src/java/com/threerings/whirled/data/SceneModel.java b/src/java/com/threerings/whirled/data/SceneModel.java index df7af4ea3..d481fbfbf 100644 --- a/src/java/com/threerings/whirled/data/SceneModel.java +++ b/src/java/com/threerings/whirled/data/SceneModel.java @@ -1,5 +1,5 @@ // -// $Id: SceneModel.java,v 1.5 2001/12/12 02:47:17 mdb Exp $ +// $Id: SceneModel.java,v 1.6 2001/12/12 19:06:15 mdb Exp $ package com.threerings.whirled.data; @@ -27,6 +27,9 @@ public class SceneModel /** This scene's unique identifier. */ public int sceneId; + /** The human readable name of this scene. */ + public String sceneName; + /** The version number of this scene. Versions are incremented * whenever modifications are made to a scene so that clients can * determine whether or not they have the latest version of a @@ -42,6 +45,7 @@ public class SceneModel throws IOException { out.writeInt(sceneId); + out.writeUTF(sceneName); out.writeInt(version); int nlength = neighborIds.length; out.writeInt(nlength); @@ -55,6 +59,7 @@ public class SceneModel throws IOException { sceneId = in.readInt(); + sceneName = in.readUTF(); version = in.readInt(); int nlength = in.readInt(); neighborIds = new int[nlength]; @@ -89,6 +94,7 @@ public class SceneModel protected void toString (StringBuffer buf) { buf.append("sceneId=").append(sceneId); + buf.append(", name=").append(sceneName); buf.append(", version=").append(version); buf.append(", neighborIds=").append(StringUtil.toString(neighborIds)); } @@ -109,6 +115,7 @@ public class SceneModel protected static void populateBlankSceneModel (SceneModel model) { model.sceneId = -1; + model.sceneName = ""; model.version = 0; model.neighborIds = new int[0]; } diff --git a/src/java/com/threerings/whirled/tools/EditableScene.java b/src/java/com/threerings/whirled/tools/EditableScene.java index bac548380..9e91795c6 100644 --- a/src/java/com/threerings/whirled/tools/EditableScene.java +++ b/src/java/com/threerings/whirled/tools/EditableScene.java @@ -1,5 +1,5 @@ // -// $Id: EditableScene.java,v 1.3 2001/12/05 03:38:09 mdb Exp $ +// $Id: EditableScene.java,v 1.4 2001/12/12 19:06:15 mdb Exp $ package com.threerings.whirled.tools; @@ -32,6 +32,11 @@ public interface EditableScene extends DisplayScene */ public void setId (int sceneId); + /** + * Sets the human readable name of this scene. + */ + public void setName (String name); + /** * Sets this scene's version number. */ @@ -42,16 +47,6 @@ public interface EditableScene extends DisplayScene */ public void setNeighborIds (int[] neighborIds); - /** - * Returns the human readable name of this scene. - */ - public String getName (); - - /** - * Setse the human readable name of this scene. - */ - public void setName (String name); - /** * Returns the names of the neighbors of this scene. */ diff --git a/src/java/com/threerings/whirled/tools/EditableSceneImpl.java b/src/java/com/threerings/whirled/tools/EditableSceneImpl.java index d5807b4ac..90b76add9 100644 --- a/src/java/com/threerings/whirled/tools/EditableSceneImpl.java +++ b/src/java/com/threerings/whirled/tools/EditableSceneImpl.java @@ -1,5 +1,5 @@ // -// $Id: EditableSceneImpl.java,v 1.5 2001/12/05 08:45:06 mdb Exp $ +// $Id: EditableSceneImpl.java,v 1.6 2001/12/12 19:06:15 mdb Exp $ package com.threerings.whirled.tools; @@ -50,6 +50,12 @@ public class EditableSceneImpl implements EditableScene return _delegate.getId(); } + // documentation inherited + public String getName () + { + return _delegate.getName(); + } + // documentation inherited public int getVersion () { @@ -74,6 +80,12 @@ public class EditableSceneImpl implements EditableScene _model.sceneId = sceneId; } + // documentation inherited + public void setName (String name) + { + _model.sceneName = name; + } + // documentation inherited public void setVersion (int version) { @@ -86,18 +98,6 @@ public class EditableSceneImpl implements EditableScene _model.neighborIds = neighborIds; } - // documentation inherited - public String getName () - { - return _emodel.sceneName; - } - - // documentation inherited - public void setName (String name) - { - _emodel.sceneName = name; - } - // documentation inherited public ArrayList getNeighborNames () { diff --git a/src/java/com/threerings/whirled/tools/EditableSceneModel.java b/src/java/com/threerings/whirled/tools/EditableSceneModel.java index 0e9278bf9..0bb385daa 100644 --- a/src/java/com/threerings/whirled/tools/EditableSceneModel.java +++ b/src/java/com/threerings/whirled/tools/EditableSceneModel.java @@ -1,5 +1,5 @@ // -// $Id: EditableSceneModel.java,v 1.3 2001/12/12 02:47:17 mdb Exp $ +// $Id: EditableSceneModel.java,v 1.4 2001/12/12 19:06:15 mdb Exp $ package com.threerings.whirled.tools; @@ -17,9 +17,6 @@ public class EditableSceneModel /** The scene model that we extend. */ public SceneModel sceneModel; - /** The human readable name of this scene. */ - public String sceneName; - /** The human readable name of this scene's neighbors. */ public ArrayList neighborNames; @@ -65,7 +62,6 @@ public class EditableSceneModel */ protected void toString (StringBuffer buf) { - buf.append(", sceneName=").append(sceneName); buf.append(", neighborNames="). append(StringUtil.toString(neighborNames)); } @@ -86,7 +82,6 @@ public class EditableSceneModel */ protected static void populateBlankSceneModel (EditableSceneModel model) { - model.sceneName = ""; model.neighborNames = new ArrayList(); } }