diff --git a/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java b/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java index 8eccfb397..2aeb7deaf 100644 --- a/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java +++ b/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java @@ -1,5 +1,5 @@ // -// $Id: SpotSceneDirector.java,v 1.30 2003/06/03 21:41:33 ray Exp $ +// $Id: SpotSceneDirector.java,v 1.31 2003/08/13 00:11:03 mdb Exp $ package com.threerings.whirled.spot.client; @@ -176,10 +176,12 @@ public class SpotSceneDirector extends BasicDirector return; } - Log.info("Sending changeLocation request " + loc + "."); + int sceneId = _scdir.getScene().getId(); + Log.info("Sending changeLocation request [scid=" + sceneId + + ", loc=" + loc + "]."); _pendingLoc = (Location)loc.clone(); - _sservice.changeLocation(_ctx.getClient(), loc, new ConfirmListener() { + ConfirmListener clist = new ConfirmListener() { public void requestProcessed () { _location = _pendingLoc; _pendingLoc = null; @@ -194,7 +196,8 @@ public class SpotSceneDirector extends BasicDirector listener.requestFailed(new Exception(reason)); } } - }); + }; + _sservice.changeLocation(_ctx.getClient(), sceneId, loc, clist); } /** diff --git a/src/java/com/threerings/whirled/spot/client/SpotService.java b/src/java/com/threerings/whirled/spot/client/SpotService.java index d8cf5c36a..8e1e51cbf 100644 --- a/src/java/com/threerings/whirled/spot/client/SpotService.java +++ b/src/java/com/threerings/whirled/spot/client/SpotService.java @@ -1,5 +1,5 @@ // -// $Id: SpotService.java,v 1.15 2003/03/27 00:10:08 mdb Exp $ +// $Id: SpotService.java,v 1.16 2003/08/13 00:11:03 mdb Exp $ package com.threerings.whirled.spot.client; @@ -33,9 +33,10 @@ public interface SpotService extends InvocationService * location. The user will be removed from any cluster from which they * are an occupant. * + * @param sceneId the id of the scene in which to change location. * @param loc the location to which to move. */ - public void changeLocation (Client client, Location loc, + public void changeLocation (Client client, int sceneId, Location loc, ConfirmListener listener); /** diff --git a/src/java/com/threerings/whirled/spot/data/SpotMarshaller.java b/src/java/com/threerings/whirled/spot/data/SpotMarshaller.java index ed552824e..0110d7b8b 100644 --- a/src/java/com/threerings/whirled/spot/data/SpotMarshaller.java +++ b/src/java/com/threerings/whirled/spot/data/SpotMarshaller.java @@ -1,5 +1,5 @@ // -// $Id: SpotMarshaller.java,v 1.4 2003/03/26 02:06:06 mdb Exp $ +// $Id: SpotMarshaller.java,v 1.5 2003/08/13 00:11:03 mdb Exp $ package com.threerings.whirled.spot.data; @@ -39,12 +39,12 @@ public class SpotMarshaller extends InvocationMarshaller public static final int CHANGE_LOCATION = 2; // documentation inherited from interface - public void changeLocation (Client arg1, Location arg2, ConfirmListener arg3) + public void changeLocation (Client arg1, int arg2, Location arg3, ConfirmListener arg4) { - ConfirmMarshaller listener3 = new ConfirmMarshaller(); - listener3.listener = arg3; + ConfirmMarshaller listener4 = new ConfirmMarshaller(); + listener4.listener = arg4; sendRequest(arg1, CHANGE_LOCATION, new Object[] { - arg2, listener3 + new Integer(arg2), arg3, listener4 }); } diff --git a/src/java/com/threerings/whirled/spot/server/SpotDispatcher.java b/src/java/com/threerings/whirled/spot/server/SpotDispatcher.java index a95ddfa38..7254dba4e 100644 --- a/src/java/com/threerings/whirled/spot/server/SpotDispatcher.java +++ b/src/java/com/threerings/whirled/spot/server/SpotDispatcher.java @@ -1,5 +1,5 @@ // -// $Id: SpotDispatcher.java,v 1.4 2003/03/26 02:06:06 mdb Exp $ +// $Id: SpotDispatcher.java,v 1.5 2003/08/13 00:11:03 mdb Exp $ package com.threerings.whirled.spot.server; @@ -51,7 +51,7 @@ public class SpotDispatcher extends InvocationDispatcher case SpotMarshaller.CHANGE_LOCATION: ((SpotProvider)provider).changeLocation( source, - (Location)args[0], (ConfirmListener)args[1] + ((Integer)args[0]).intValue(), (Location)args[1], (ConfirmListener)args[2] ); return; diff --git a/src/java/com/threerings/whirled/spot/server/SpotProvider.java b/src/java/com/threerings/whirled/spot/server/SpotProvider.java index 614236495..93808a6a7 100644 --- a/src/java/com/threerings/whirled/spot/server/SpotProvider.java +++ b/src/java/com/threerings/whirled/spot/server/SpotProvider.java @@ -1,5 +1,5 @@ // -// $Id: SpotProvider.java,v 1.19 2003/07/18 01:58:38 eric Exp $ +// $Id: SpotProvider.java,v 1.20 2003/08/13 00:11:03 mdb Exp $ package com.threerings.whirled.spot.server; @@ -155,12 +155,18 @@ public class SpotProvider /** * Processes a {@link SpotService#changeLocation} request. */ - public void changeLocation (ClientObject caller, Location loc, + public void changeLocation (ClientObject caller, int sceneId, Location loc, SpotService.ConfirmListener listener) throws InvocationException { - int sceneId = getCallerSceneId(caller); BodyObject source = (BodyObject)caller; + int cSceneId = getCallerSceneId(caller); + if (cSceneId != sceneId) { + Log.warning("Rejecting changeLocation for invalid scene " + + "[user=" + source.who() + ", insid=" + cSceneId + + ", wantsid=" + sceneId + ", loc=" + loc + "]."); + throw new InvocationException(INVALID_LOCATION); + } // look up the scene manager for the specified scene SpotSceneManager smgr = (SpotSceneManager)