From 5708f5620351d764655a0f088f4f265e7cd4aa31 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 12 Jul 2006 02:22:32 +0000 Subject: [PATCH] Match recent changes in our corresponding java classes. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@14 c613c5cb-e716-0410-b11b-feb51c14d237 --- src/as/com/threerings/whirled/spot/data/Portal.as | 9 +++++---- src/as/com/threerings/whirled/spot/data/SpotSceneImpl.as | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/as/com/threerings/whirled/spot/data/Portal.as b/src/as/com/threerings/whirled/spot/data/Portal.as index 5805661f..1a119532 100644 --- a/src/as/com/threerings/whirled/spot/data/Portal.as +++ b/src/as/com/threerings/whirled/spot/data/Portal.as @@ -82,11 +82,13 @@ public class Portal /** * Returns true if the portal has a potentially valid target scene and * portal id (they are not guaranteed to exist, but they are at least - * potentially valid values rather than -1 or 0). + * potentially valid values rather than 0). */ public function isValid () :Boolean { - return (targetSceneId > 0) && (targetPortalId > 0); + return (targetSceneId > 0) && + // the target portal must be positive, or -1 + ((targetPortalId > 0) || (targetPortalId == -1)); } // documentation inherited from interface Streamable @@ -110,8 +112,7 @@ public class Portal // documentation inherited from interface Cloneable public function clone () :Object { - var clazz :Class = ClassUtil.getClass(this); - var p :Portal = new clazz(); + var p :Portal = (ClassUtil.newInstance(this) as Portal); p.portalId = portalId; p.loc = loc; p.targetSceneId = targetSceneId; diff --git a/src/as/com/threerings/whirled/spot/data/SpotSceneImpl.as b/src/as/com/threerings/whirled/spot/data/SpotSceneImpl.as index 1cb2e87b..578f9e08 100644 --- a/src/as/com/threerings/whirled/spot/data/SpotSceneImpl.as +++ b/src/as/com/threerings/whirled/spot/data/SpotSceneImpl.as @@ -57,6 +57,9 @@ public class SpotSceneImpl // documentation inherited from interface public function getPortal (portalId :int) :Portal { + if (portalId == -1) { + portalId = _smodel.defaultEntranceId; + } return (_portals.get(portalId) as Portal); } @@ -87,7 +90,7 @@ public class SpotSceneImpl // documentation inherited from interface public function getDefaultEntrance () :Portal { - return getPortal(_smodel.defaultEntranceId); + return getPortal(-1); // -1 is a shortcut meaning "default" } // documentation inherited from interface