Provide an extensible way (what a fancy way to describe a protected
method) for validating whether a body can stand at their requested location. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2333 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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;
|
package com.threerings.whirled.spot.data;
|
||||||
|
|
||||||
@@ -21,6 +21,10 @@ public interface SpotCodes extends ChatCodes, SceneCodes
|
|||||||
* generated by a failed changeLoc request. */
|
* generated by a failed changeLoc request. */
|
||||||
public static final String LOCATION_OCCUPIED = "m.location_occupied";
|
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
|
/** The chat type code with which we register our cluster auxiliary
|
||||||
* chat objects. Chat display implementations should interpret chat
|
* chat objects. Chat display implementations should interpret chat
|
||||||
* messages with this type accordingly. */
|
* messages with this type accordingly. */
|
||||||
|
|||||||
@@ -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;
|
package com.threerings.whirled.spot.server;
|
||||||
|
|
||||||
@@ -183,7 +183,10 @@ public class SpotSceneManager extends SceneManager
|
|||||||
throw new InvocationException(INTERNAL_ERROR);
|
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
|
// update the user's location information in the scene which will
|
||||||
// indicate to the client that their avatar should be moved from
|
// indicate to the client that their avatar should be moved from
|
||||||
@@ -194,6 +197,17 @@ public class SpotSceneManager extends SceneManager
|
|||||||
removeFromCluster(source.getOid());
|
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 <code>true</code> in all circumstances;
|
||||||
|
* stand where ye may!
|
||||||
|
*/
|
||||||
|
protected boolean validateLocation (BodyObject source, Location loc)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the location of the specified body.
|
* Updates the location of the specified body.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user