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
This commit is contained in:
Michael Bayne
2001-12-03 19:40:11 +00:00
parent 7d108a256f
commit 1c823ae349
2 changed files with 10 additions and 21 deletions
@@ -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;
}
/**
@@ -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
{