Require that the current scene be specified in the change location request
because odd things frequently happen if a player somehow double clicks or in some other way queues up a change scene then a change loc from the previous scene. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2768 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user