diff --git a/src/java/com/threerings/whirled/spot/client/DisplaySpotScene.java b/src/java/com/threerings/whirled/spot/client/DisplaySpotScene.java index 84bdee74e..03aae15de 100644 --- a/src/java/com/threerings/whirled/spot/client/DisplaySpotScene.java +++ b/src/java/com/threerings/whirled/spot/client/DisplaySpotScene.java @@ -1,5 +1,5 @@ // -// $Id: DisplaySpotScene.java,v 1.3 2001/12/05 08:45:05 mdb Exp $ +// $Id: DisplaySpotScene.java,v 1.4 2001/12/16 21:22:30 mdb Exp $ package com.threerings.whirled.spot.client; @@ -28,6 +28,20 @@ public interface DisplaySpotScene extends DisplayScene */ public List getLocations (); + /** + * Convenience function for obtaining a location's index in the + * location list given its id. + * + * @return the location's index or -1 if a location with the specified + * id is not in this scene's location list. + */ + public int getLocationIndex (int locationId); + + /** + * Convenience funtion for looking up a location by id. + */ + public Location getLocation (int locationId); + /** * Returns a list of the portals in this scene. */ diff --git a/src/java/com/threerings/whirled/spot/client/DisplaySpotSceneImpl.java b/src/java/com/threerings/whirled/spot/client/DisplaySpotSceneImpl.java index b6ab172af..992c333b6 100644 --- a/src/java/com/threerings/whirled/spot/client/DisplaySpotSceneImpl.java +++ b/src/java/com/threerings/whirled/spot/client/DisplaySpotSceneImpl.java @@ -1,5 +1,5 @@ // -// $Id: DisplaySpotSceneImpl.java,v 1.4 2001/12/05 08:45:05 mdb Exp $ +// $Id: DisplaySpotSceneImpl.java,v 1.5 2001/12/16 21:22:30 mdb Exp $ package com.threerings.whirled.spot.client; @@ -112,6 +112,32 @@ public class DisplaySpotSceneImpl extends DisplaySceneImpl return _locations; } + // documentation inherited + public int getLocationIndex (int locationId) + { + int lsize = _locations.size(); + for (int i = 0; i < lsize; i++) { + Location loc = (Location)_locations.get(i); + if (loc.locationId == locationId) { + return i; + } + } + return -1; + } + + // documentation inherited + public Location getLocation (int locationId) + { + int lsize = _locations.size(); + for (int i = 0; i < lsize; i++) { + Location loc = (Location)_locations.get(i); + if (loc.locationId == locationId) { + return loc; + } + } + return null; + } + // documentation inherited public List getPortals () { diff --git a/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneImpl.java b/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneImpl.java index d54cad25c..8449077c7 100644 --- a/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneImpl.java +++ b/src/java/com/threerings/whirled/spot/tools/EditableSpotSceneImpl.java @@ -1,5 +1,5 @@ // -// $Id: EditableSpotSceneImpl.java,v 1.9 2001/12/07 02:10:14 mdb Exp $ +// $Id: EditableSpotSceneImpl.java,v 1.10 2001/12/16 21:22:31 mdb Exp $ package com.threerings.whirled.tools.spot; @@ -119,6 +119,18 @@ public class EditableSpotSceneImpl extends EditableSceneImpl return _delegate.getLocations(); } + // documentation inherited + public int getLocationIndex (int locationId) + { + return _delegate.getLocationIndex(locationId); + } + + // documentation inherited + public Location getLocation (int locationId) + { + return _delegate.getLocation(locationId); + } + // documentation inherited public List getPortals () {