diff --git a/src/java/com/threerings/whirled/spot/data/SpotCodes.java b/src/java/com/threerings/whirled/spot/data/SpotCodes.java index 6d37c4555..bed5dd514 100644 --- a/src/java/com/threerings/whirled/spot/data/SpotCodes.java +++ b/src/java/com/threerings/whirled/spot/data/SpotCodes.java @@ -1,5 +1,5 @@ // -// $Id: SpotCodes.java,v 1.3 2002/08/14 19:07:58 mdb Exp $ +// $Id: SpotCodes.java,v 1.4 2003/03/26 22:34:24 mdb Exp $ package com.threerings.whirled.spot.data; @@ -21,6 +21,10 @@ public interface SpotCodes extends ChatCodes, SceneCodes * generated by a failed changeLoc request. */ public static final String LOCATION_OCCUPIED = "m.location_occupied"; + /** An error code indicating that a location is not valid. Usually + * generated by a failed changeLoc request. */ + public static final String INVALID_LOCATION = "m.invalid_location"; + /** The chat type code with which we register our cluster auxiliary * chat objects. Chat display implementations should interpret chat * messages with this type accordingly. */ diff --git a/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java b/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java index 1d4cd38a2..19486c908 100644 --- a/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java +++ b/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java @@ -1,5 +1,5 @@ // -// $Id: SpotSceneManager.java,v 1.32 2003/03/26 18:18:29 mdb Exp $ +// $Id: SpotSceneManager.java,v 1.33 2003/03/26 22:34:24 mdb Exp $ package com.threerings.whirled.spot.server; @@ -183,7 +183,10 @@ public class SpotSceneManager extends SceneManager throw new InvocationException(INTERNAL_ERROR); } - // TODO: make sure the location isn't too close to another user + // let our derived classes decide if this is an OK place to stand + if (!validateLocation(source, loc)) { + throw new InvocationException(INTERNAL_ERROR); + } // update the user's location information in the scene which will // indicate to the client that their avatar should be moved from @@ -194,6 +197,17 @@ public class SpotSceneManager extends SceneManager removeFromCluster(source.getOid()); } + /** + * Derived classes can override this method and validate that the + * specified body can stand in the requested location. The default + * implementation returns true in all circumstances; + * stand where ye may! + */ + protected boolean validateLocation (BodyObject source, Location loc) + { + return true; + } + /** * Updates the location of the specified body. */