diff --git a/src/as/com/threerings/whirled/client/SceneDirector.as b/src/as/com/threerings/whirled/client/SceneDirector.as index 05bde80e..65e8c465 100644 --- a/src/as/com/threerings/whirled/client/SceneDirector.as +++ b/src/as/com/threerings/whirled/client/SceneDirector.as @@ -198,6 +198,20 @@ public class SceneDirector extends BasicDirector return true; } + /** + * Returns a function that may be used to restore the scene director's pendingData to its + * current state. This is primarily useful if you know something (such as a logoff) is about + * to happen and you want to ensure you can restore the pending data after re-login. + */ + public function getPendingDataRestoreFunc () :Function + { + var pendingData :PendingData = _pendingData; + + return function () :void { + _pendingData = pendingData; + } + } + /** * Returns the model loaded in preparation for a scene transition. This is made available only * for cooperating directors which may need to coopt the scene transition process. The pending diff --git a/src/as/com/threerings/whirled/zone/client/ZoneDirector.as b/src/as/com/threerings/whirled/zone/client/ZoneDirector.as index 18ab5959..1a96ad79 100644 --- a/src/as/com/threerings/whirled/zone/client/ZoneDirector.as +++ b/src/as/com/threerings/whirled/zone/client/ZoneDirector.as @@ -11,6 +11,7 @@ import com.threerings.presents.client.ConfirmAdapter; import com.threerings.crowd.data.PlaceConfig; +import com.threerings.whirled.client.PendingData; import com.threerings.whirled.client.SceneDirector; import com.threerings.whirled.client.SceneDirector_MoveHandler; import com.threerings.whirled.data.SceneModel; @@ -201,8 +202,14 @@ public class ZoneDirector extends BasicDirector { log.info("Zone switch requires server switch", "host", hostname, "ports", ports); // ship on over to the other server + + // keep track of our current pending data because it will be cleared when we log off of + // this server and onto the next one + var restorePending :Function = _scdir.getPendingDataRestoreFunc(); + _wCtx.getClient().moveToServer(hostname, ports, new ConfirmAdapter( function () :void { // succeeded + restorePending(); sendMoveRequest(); }, requestFailed)); }