From 7c96663f44f93857b8ff2026304cdf9fcb6f571c Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 21 Sep 2001 00:21:40 +0000 Subject: [PATCH] Minor scene changes. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@342 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../miso/client/DisplayMisoSceneImpl.java | 205 +++++++++--------- .../threerings/whirled/data/DummyScene.java | 9 +- .../com/threerings/whirled/data/Scene.java | 23 +- 3 files changed, 126 insertions(+), 111 deletions(-) diff --git a/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java b/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java index c6c7c603a..d1de99438 100644 --- a/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java +++ b/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java @@ -1,5 +1,5 @@ // -// $Id: DisplayMisoSceneImpl.java,v 1.33 2001/08/29 19:50:46 shaper Exp $ +// $Id: DisplayMisoSceneImpl.java,v 1.34 2001/09/21 00:21:40 mdb Exp $ package com.threerings.miso.scene; @@ -108,6 +108,103 @@ public class MisoScene implements Scene this.tiles = tiles; } + // documentation inherited + public String getName () + { + return _name; + } + + // documentation inherited + public int getId () + { + return _sid; + } + + // documentation inherited + public int getVersion () + { + // fake it for now + return 1; + } + + // documentation inherited + public int[] getNeighborIds () + { + return null; + } + + /** + * Return the default tile for the base layer of the scene. + */ + public Tile getDefaultTile () + { + return _deftile; + } + + /** + * Return the scene locations list. + */ + public ArrayList getLocations () + { + return _locations; + } + + /** + * Return the cluster list. + */ + public ArrayList getClusters () + { + return _clusters; + } + + /** + * Return the scene portals list. + */ + public ArrayList getPortals () + { + return _portals; + } + + /** + * Set the default entrance portal for this scene. + * + * @param entrance the entrance portal. + */ + public void setEntrance (Portal entrance) + { + _entrance = entrance; + } + + /** + * Return the number of clusters in the scene. + */ + public int getNumClusters () + { + return _clusters.size(); + } + + /** + * Return the number of actual (non-null) tiles present in the + * specified tile layer for this scene. + */ + public int getNumLayerTiles (int lnum) + { + if (lnum == LAYER_BASE) { + return _model.scenewid * _model.scenehei; + } + + int numTiles = 0; + for (int xx = 0; xx < _model.scenewid; xx++) { + for (int yy = 0; yy < _model.scenehei; yy++) { + if (tiles[xx][yy] != null) { + numTiles++; + } + } + } + + return numTiles; + } + /** * Return the cluster index number the given location is in, or -1 * if the location is not in any cluster. @@ -203,16 +300,6 @@ public class MisoScene implements Scene _portals.remove(loc); } - /** - * Set the default entrance portal for this scene. - * - * @param entrance the entrance portal. - */ - public void setEntrance (Portal entrance) - { - _entrance = entrance; - } - /** * Return the portal with the given name, or null if the portal * isn't found in the portal list. @@ -231,102 +318,6 @@ public class MisoScene implements Scene return null; } - /** - * Return the scene name. - */ - public String getName () - { - return _name; - } - - /** - * Return the scene identifier. - */ - public int getId () - { - return _sid; - } - - /** - * Returns this scene's version number (which is incremented when it - * is modified and stored into the scene repository). - */ - public int getVersion () - { - // fake it for now - return 1; - } - - /** - * Returns the scene ids of the portals from this scene. - */ - public int[] getPortalIds () - { - return null; - } - - /** - * Return the scene locations list. - */ - public ArrayList getLocations () - { - return _locations; - } - - /** - * Return the cluster list. - */ - public ArrayList getClusters () - { - return _clusters; - } - - /** - * Return the scene portals list. - */ - public ArrayList getPortals () - { - return _portals; - } - - /** - * Return the number of clusters in the scene. - */ - public int getNumClusters () - { - return _clusters.size(); - } - - /** - * Return the number of actual (non-null) tiles present in the - * specified tile layer for this scene. - */ - public int getNumLayerTiles (int lnum) - { - if (lnum == LAYER_BASE) { - return _model.scenewid * _model.scenehei; - } - - int numTiles = 0; - for (int xx = 0; xx < _model.scenewid; xx++) { - for (int yy = 0; yy < _model.scenehei; yy++) { - if (tiles[xx][yy] != null) { - numTiles++; - } - } - } - - return numTiles; - } - - /** - * Return the default tile for the base layer of the scene. - */ - public Tile getDefaultTile () - { - return _deftile; - } - /** * Return a string representation of this Scene object. */ diff --git a/src/java/com/threerings/whirled/data/DummyScene.java b/src/java/com/threerings/whirled/data/DummyScene.java index a0af9666e..7790322dd 100644 --- a/src/java/com/threerings/whirled/data/DummyScene.java +++ b/src/java/com/threerings/whirled/data/DummyScene.java @@ -1,5 +1,5 @@ // -// $Id: DummyScene.java,v 1.2 2001/08/16 18:05:17 shaper Exp $ +// $Id: DummyScene.java,v 1.3 2001/09/21 00:21:40 mdb Exp $ package com.threerings.whirled.client.test; @@ -22,7 +22,12 @@ public class DummyScene implements Scene return 1; } - public int[] getPortalIds () + public String getName () + { + return "scene"; + } + + public int[] getNeighborIds () { return null; } diff --git a/src/java/com/threerings/whirled/data/Scene.java b/src/java/com/threerings/whirled/data/Scene.java index 6816dfc92..4ecb2b81f 100644 --- a/src/java/com/threerings/whirled/data/Scene.java +++ b/src/java/com/threerings/whirled/data/Scene.java @@ -1,5 +1,5 @@ // -// $Id: Scene.java,v 1.2 2001/08/16 18:05:17 shaper Exp $ +// $Id: Scene.java,v 1.3 2001/09/21 00:21:40 mdb Exp $ package com.threerings.whirled.data; @@ -9,9 +9,28 @@ package com.threerings.whirled.data; */ public interface Scene { + /** + * Returns the scene's unique identifier. + */ public int getId (); + /** + * Returns the scene's version. The version should be updated every + * time the scene is modified and stored back to the repository. This + * allows a client to determine whether or not they need an updated + * version of the scene for their local cache. + */ public int getVersion (); - public int[] getPortalIds (); + /** + * Returns the scene's name. Every scene has a descriptive name. + */ + public String getName (); + + /** + * Returns the scene ids of all scenes that neighbor this scene. A + * neighboring scene is one to which the user can traverse from this + * scene and vice versa. + */ + public int[] getNeighborIds (); }