diff --git a/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java b/src/java/com/threerings/miso/client/DisplayMisoSceneImpl.java index 3770cd1e5..ddd6e23d0 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.23 2001/08/10 23:07:04 shaper Exp $ +// $Id: DisplayMisoSceneImpl.java,v 1.24 2001/08/11 00:00:13 shaper Exp $ package com.threerings.miso.scene; @@ -115,6 +115,14 @@ public class Scene return ClusterUtil.getClusterIndex(_clusters, loc); } + /** + * Update the specified location in the scene. If the cluster + * index number is -1, the location will be removed from any + * cluster it may reside in. + * + * @param loc the location. + * @param clusteridx the cluster index number. + */ public void updateLocation (Location loc, int clusteridx) { // look the location up in our existing location list @@ -195,6 +203,9 @@ public class Scene return _exits; } + /** + * Return the number of clusters in the scene. + */ public int getNumClusters () { return _clusters.size(); diff --git a/src/java/com/threerings/miso/client/Exit.java b/src/java/com/threerings/miso/client/Exit.java index 5565aa956..279cf9790 100644 --- a/src/java/com/threerings/miso/client/Exit.java +++ b/src/java/com/threerings/miso/client/Exit.java @@ -1,19 +1,14 @@ // -// $Id: Exit.java,v 1.1 2001/08/09 21:17:06 shaper Exp $ +// $Id: Exit.java,v 1.2 2001/08/11 00:00:13 shaper Exp $ package com.threerings.miso.scene; /** * The Exit class represents a Location in a * scene that leads to a different scene. - * - * @see Location */ -public class Exit +public class Exit extends Location { - /** The location this exit is associated with. */ - public Location loc; - /** The scene name this exit transitions to. */ public String name; @@ -25,18 +20,16 @@ public class Exit */ public Exit (Location loc, String name) { - this.loc = loc; + super(loc.x, loc.y, loc.orient); this.name = name; } /** * Return a String representation of this object. */ - public String toString () + protected void toString (StringBuffer buf) { - StringBuffer buf = new StringBuffer(); - buf.append("[loc=").append(loc); + super.toString(buf); buf.append(", name=").append(name); - return buf.append("]").toString(); } } diff --git a/src/java/com/threerings/miso/client/IsoSceneView.java b/src/java/com/threerings/miso/client/IsoSceneView.java index e53780494..688a20790 100644 --- a/src/java/com/threerings/miso/client/IsoSceneView.java +++ b/src/java/com/threerings/miso/client/IsoSceneView.java @@ -1,5 +1,5 @@ // -// $Id: IsoSceneView.java,v 1.39 2001/08/10 23:07:04 shaper Exp $ +// $Id: IsoSceneView.java,v 1.40 2001/08/11 00:00:13 shaper Exp $ package com.threerings.miso.scene; @@ -390,11 +390,6 @@ public class IsoSceneView implements EditableSceneView IsoUtil.screenToFull(_model, x, y, _hfull); } - public void getFullCoordinates (int sx, int sy, Point fpos) - { - IsoUtil.screenToFull(_model, sx, sy, fpos); - } - /** * Invalidate a list of rectangles in the view for later repainting. * @@ -564,9 +559,18 @@ public class IsoSceneView implements EditableSceneView _scene.updateLocation(loc, clusteridx); } - public Location getLocation (int x, int y) + public Location createLocation (int sx, int sy) { - return _scene.getLocation(x, y); + Point fpos = new Point(); + IsoUtil.screenToFull(_model, sx, sy, fpos); + return new Location(fpos.x, fpos.y); + } + + public Location getLocation (int sx, int sy) + { + Point fpos = new Point(); + IsoUtil.screenToFull(_model, sx, sy, fpos); + return _scene.getLocation(fpos.x, fpos.y); } public int getClusterIndex (Location loc) diff --git a/src/java/com/threerings/miso/client/Location.java b/src/java/com/threerings/miso/client/Location.java index 972a1e482..5c10a634f 100644 --- a/src/java/com/threerings/miso/client/Location.java +++ b/src/java/com/threerings/miso/client/Location.java @@ -1,5 +1,5 @@ // -// $Id: Location.java,v 1.3 2001/08/10 23:07:04 shaper Exp $ +// $Id: Location.java,v 1.4 2001/08/11 00:00:13 shaper Exp $ package com.threerings.miso.scene; @@ -54,9 +54,20 @@ public class Location public String toString () { StringBuffer buf = new StringBuffer(); - buf.append("[x=").append(x); - buf.append(", y=").append(y); - buf.append(", orient=").append(orient); + buf.append("["); + toString(buf); return buf.append("]").toString(); } + + /** + * This should be overridden by derived classes (which should be sure + * to call super.toString()) to append the derived class + * specific event information to the string buffer. + */ + protected void toString (StringBuffer buf) + { + buf.append("x=").append(x); + buf.append(", y=").append(y); + buf.append(", orient=").append(orient); + } }