Return true from moveTo() if we actually sent the request, false if the
request was rejected out of hand. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1458 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LocationDirector.java,v 1.22 2002/06/14 01:19:16 mdb Exp $
|
||||
// $Id: LocationDirector.java,v 1.23 2002/06/14 01:24:48 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.client;
|
||||
|
||||
@@ -96,13 +96,17 @@ public class LocationDirector
|
||||
* Requests that this client be moved to the specified place. A
|
||||
* request will be made and when the response is received, the
|
||||
* location observers will be notified of success or failure.
|
||||
*
|
||||
* @return true if the move to request was issued, false if it was
|
||||
* rejected by a location observer or because we have another request
|
||||
* outstanding.
|
||||
*/
|
||||
public void moveTo (int placeId)
|
||||
public boolean moveTo (int placeId)
|
||||
{
|
||||
// first check to see if our observers are happy with this move
|
||||
// request
|
||||
if (!mayMoveTo(placeId)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// we need to call this both to mark that we're issuing a move
|
||||
@@ -119,7 +123,7 @@ public class LocationDirector
|
||||
Log.warning("Refusing moveTo; We have a request outstanding " +
|
||||
"[ppid=" + _pendingPlaceId +
|
||||
", npid=" + placeId + "].");
|
||||
return;
|
||||
return false;
|
||||
|
||||
} else {
|
||||
Log.warning("Overriding stale moveTo request " +
|
||||
@@ -133,6 +137,7 @@ public class LocationDirector
|
||||
|
||||
// issue a moveTo request
|
||||
LocationService.moveTo(_ctx.getClient(), placeId, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneDirector.java,v 1.17 2002/06/14 01:19:16 mdb Exp $
|
||||
// $Id: SceneDirector.java,v 1.18 2002/06/14 01:24:49 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.client;
|
||||
|
||||
@@ -86,19 +86,23 @@ public class SceneDirector
|
||||
* Requests that this client move the specified scene. A request will
|
||||
* be made and when the response is received, the location observers
|
||||
* will be notified of success or failure.
|
||||
*
|
||||
* @return true if the move to request was issued, false if it was
|
||||
* rejected by a location observer or because we have another request
|
||||
* outstanding.
|
||||
*/
|
||||
public void moveTo (int sceneId)
|
||||
public boolean moveTo (int sceneId)
|
||||
{
|
||||
// sanity-check the destination scene id
|
||||
if (sceneId == _sceneId) {
|
||||
Log.warning("Refusing request to move to the same scene " +
|
||||
"[sceneId=" + sceneId + "].");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// prepare to move to this scene (sets up pending data)
|
||||
if (!prepareMoveTo(sceneId)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the version of our cached copy of the scene to which
|
||||
@@ -111,6 +115,7 @@ public class SceneDirector
|
||||
|
||||
// issue a moveTo request
|
||||
SceneService.moveTo(_ctx.getClient(), sceneId, sceneVers, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ZoneDirector.java,v 1.6 2002/05/26 02:35:02 mdb Exp $
|
||||
// $Id: ZoneDirector.java,v 1.7 2002/06/14 01:24:49 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.client;
|
||||
|
||||
@@ -76,36 +76,36 @@ public class ZoneDirector
|
||||
* zone. A request will be made and when the response is received, the
|
||||
* location observers will be notified of success or failure.
|
||||
*/
|
||||
public void moveTo (int zoneId, int sceneId)
|
||||
public boolean moveTo (int zoneId, int sceneId)
|
||||
{
|
||||
// if the requested zone is the same as our current zone, we just
|
||||
// want a regular old moveTo request
|
||||
if (_summary != null && zoneId == _summary.zoneId) {
|
||||
_scdir.moveTo(sceneId);
|
||||
|
||||
} else { // otherwise, we make a zoned moveTo request
|
||||
// prepare to move to this scene (sets up pending data)
|
||||
if (!_scdir.prepareMoveTo(sceneId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// let our zone observers know that we're attempting to switch
|
||||
// zones
|
||||
notifyObservers(new Integer(zoneId));
|
||||
|
||||
// check the version of our cached copy of the scene to which
|
||||
// we're requesting to move; if we were unable to load it, assume
|
||||
// a cached version of zero
|
||||
int sceneVers = 0;
|
||||
SceneModel pendingModel = _scdir.getPendingModel();
|
||||
if (pendingModel != null) {
|
||||
sceneVers = pendingModel.version;
|
||||
}
|
||||
|
||||
// issue a moveTo request
|
||||
ZoneService.moveTo(_ctx.getClient(), zoneId,
|
||||
sceneId, sceneVers, this);
|
||||
return _scdir.moveTo(sceneId);
|
||||
}
|
||||
|
||||
// otherwise, we make a zoned moveTo request; prepare to move to
|
||||
// this scene (sets up pending data)
|
||||
if (!_scdir.prepareMoveTo(sceneId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// let our zone observers know that we're attempting to switch
|
||||
// zones
|
||||
notifyObservers(new Integer(zoneId));
|
||||
|
||||
// check the version of our cached copy of the scene to which
|
||||
// we're requesting to move; if we were unable to load it, assume
|
||||
// a cached version of zero
|
||||
int sceneVers = 0;
|
||||
SceneModel pendingModel = _scdir.getPendingModel();
|
||||
if (pendingModel != null) {
|
||||
sceneVers = pendingModel.version;
|
||||
}
|
||||
|
||||
// issue a moveTo request
|
||||
ZoneService.moveTo(_ctx.getClient(), zoneId, sceneId, sceneVers, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user