Drop forced move requests if they come in while we have a move pending. We may

have to do some things on the server as well which blindly ejects the user from
their current place, but now the worst case is that a player ends up nowhere in
the event of extreme lag and clicks the button to go somewhere again rather
than having a move half-completed get aborted and the code ending up confused
and not properly able to clean up after itself.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@436 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-09-24 20:49:01 +00:00
parent e21c14c4c1
commit c76474a640
2 changed files with 28 additions and 6 deletions
@@ -244,12 +244,19 @@ public class ZoneDirector extends BasicDirector
// documentation inherited from interface
public void forcedMove (int zoneId, int sceneId)
{
Log.info("Moving at request of server [zoneId=" + zoneId +
", sceneId=" + sceneId + "].");
// if we're in the middle of a move, we can't abort it or we will screw everything up, so
// just finish up what we're doing and assume that the repeated move request was the
// spurious one as it would be in the case of lag causing rapid-fire repeat requests
if (_scdir.movePending()) {
Log.info("Dropping forced move because we have a move pending " +
"[pend=" + _scdir.getPendingModel() + ", rzId=" + zoneId +
", rsId=" + sceneId + "].");
return;
}
Log.info("Moving at request of server [zoneId=" + zoneId + ", sceneId=" + sceneId + "].");
// clear out our old scene and place data
_scdir.didLeaveScene();
// move to the new zone and scene
moveTo(zoneId, sceneId, null);
}