From 1c823ae3491349dd7fb696d61d87ecaf2a02f216 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 3 Dec 2001 19:40:11 +0000 Subject: [PATCH] Updates related to non-global-uniquifying location ids. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@721 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/whirled/spot/data/Location.java | 18 ++++-------------- .../whirled/spot/data/SpotSceneModel.java | 13 ++++++------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/java/com/threerings/whirled/spot/data/Location.java b/src/java/com/threerings/whirled/spot/data/Location.java index 2dbab38b0..0d37a378a 100644 --- a/src/java/com/threerings/whirled/spot/data/Location.java +++ b/src/java/com/threerings/whirled/spot/data/Location.java @@ -1,5 +1,5 @@ // -// $Id: Location.java,v 1.1 2001/11/13 02:25:35 mdb Exp $ +// $Id: Location.java,v 1.2 2001/12/03 19:40:11 mdb Exp $ package com.threerings.whirled.spot.data; @@ -42,23 +42,13 @@ public class Location } /** - * Location equality is determined by location id unless the location - * id is zero, in which case equality is determined by equal x and y - * coordinates. This allows locations to be created by the editor, - * where location ids cannot yet have been assigned because they are - * assigned by the scene repository, and manipulated as comparable - * entities. + * Location equality is determined by location id. */ public boolean equals (Object other) { if (other instanceof Location) { Location oloc = (Location)other; - if (locationId == 0 && oloc.locationId == 0) { - return (x == oloc.x && y == oloc.y); - } else { - return (locationId == oloc.locationId); - } - + return locationId == oloc.locationId; } else { return false; } @@ -69,7 +59,7 @@ public class Location */ public int hashCode () { - return (locationId == 0) ? (x ^ y) : locationId; + return locationId; } /** diff --git a/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java b/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java index 21fe280ba..06463fbb7 100644 --- a/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java +++ b/src/java/com/threerings/whirled/spot/data/SpotSceneModel.java @@ -1,5 +1,5 @@ // -// $Id: SpotSceneModel.java,v 1.3 2001/11/29 19:32:06 mdb Exp $ +// $Id: SpotSceneModel.java,v 1.4 2001/12/03 19:40:11 mdb Exp $ package com.threerings.whirled.spot.data; @@ -13,12 +13,11 @@ import com.threerings.whirled.data.SceneModel; /** * The spot scene model extends the standard scene model with information * on locations, clusters and portals. Locations (and by extension, - * portals) are referenced by a globally unique identifier so that portals - * can stably reference the target location in the scene to which they - * connect. The scene repository is responsible for assigning this unique - * identifier. Clusters are tracked by index rather than unique - * identifier, but only exist as an attribute of locations (a location - * belongs to zero or one clusters). + * portals) are referenced by an identifier, unique within the scene and + * unchanging, so that portals can stably reference the target location in + * the scene to which they connect. Clusters are tracked by index rather + * than unique identifier, but only exist as an attribute of locations (a + * location belongs to zero or one clusters). */ public class SpotSceneModel extends SceneModel {