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:
@@ -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;
|
package com.threerings.whirled.spot.data;
|
||||||
|
|
||||||
@@ -42,23 +42,13 @@ public class Location
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Location equality is determined by location id unless the location
|
* Location equality is determined by location id.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
public boolean equals (Object other)
|
public boolean equals (Object other)
|
||||||
{
|
{
|
||||||
if (other instanceof Location) {
|
if (other instanceof Location) {
|
||||||
Location oloc = (Location)other;
|
Location oloc = (Location)other;
|
||||||
if (locationId == 0 && oloc.locationId == 0) {
|
return locationId == oloc.locationId;
|
||||||
return (x == oloc.x && y == oloc.y);
|
|
||||||
} else {
|
|
||||||
return (locationId == oloc.locationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -69,7 +59,7 @@ public class Location
|
|||||||
*/
|
*/
|
||||||
public int hashCode ()
|
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;
|
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
|
* The spot scene model extends the standard scene model with information
|
||||||
* on locations, clusters and portals. Locations (and by extension,
|
* on locations, clusters and portals. Locations (and by extension,
|
||||||
* portals) are referenced by a globally unique identifier so that portals
|
* portals) are referenced by an identifier, unique within the scene and
|
||||||
* can stably reference the target location in the scene to which they
|
* unchanging, so that portals can stably reference the target location in
|
||||||
* connect. The scene repository is responsible for assigning this unique
|
* the scene to which they connect. Clusters are tracked by index rather
|
||||||
* identifier. Clusters are tracked by index rather than unique
|
* than unique identifier, but only exist as an attribute of locations (a
|
||||||
* identifier, but only exist as an attribute of locations (a location
|
* location belongs to zero or one clusters).
|
||||||
* belongs to zero or one clusters).
|
|
||||||
*/
|
*/
|
||||||
public class SpotSceneModel extends SceneModel
|
public class SpotSceneModel extends SceneModel
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user