diff --git a/src/java/com/threerings/crowd/client/LocationDirector.java b/src/java/com/threerings/crowd/client/LocationDirector.java index 9221329e1..94282f12f 100644 --- a/src/java/com/threerings/crowd/client/LocationDirector.java +++ b/src/java/com/threerings/crowd/client/LocationDirector.java @@ -1,5 +1,5 @@ // -// $Id: LocationDirector.java,v 1.28 2003/01/09 00:26:56 mdb Exp $ +// $Id: LocationDirector.java,v 1.29 2003/01/09 02:46:58 mdb Exp $ package com.threerings.crowd.client; @@ -185,15 +185,7 @@ public class LocationDirector extends BasicDirector // if we're actually going somewhere, let the controller know that // we might be leaving - if (_controller != null) { - try { - _controller.mayLeavePlace(_plobj); - } catch (Exception e) { - Log.warning("Place controller choked in " + - "didLeavePlace [plobj=" + _plobj + "]."); - Log.logStackTrace(e); - } - } + mayLeavePlace(); // if we have a result listener, let it know if we failed // or keep it for later if we're still going @@ -208,6 +200,23 @@ public class LocationDirector extends BasicDirector return !vetoed[0]; } + /** + * Called to inform our controller that we may be leaving the current + * place. + */ + protected void mayLeavePlace () + { + if (_controller != null) { + try { + _controller.mayLeavePlace(_plobj); + } catch (Exception e) { + Log.warning("Place controller choked in " + + "mayLeavePlace [plobj=" + _plobj + "]."); + Log.logStackTrace(e); + } + } + } + /** * This can be called by cooperating directors that need to coopt the * moving process to extend it in some way or other. In such @@ -353,6 +362,7 @@ public class LocationDirector extends BasicDirector super.clientDidLogoff(client); // clear ourselves out and inform observers of our departure + mayLeavePlace(); didLeavePlace(); // let our observers know that we're no longer in a location @@ -410,6 +420,7 @@ public class LocationDirector extends BasicDirector Log.info("Moving at request of server [placeId=" + placeId + "]."); // clear out our old place information + mayLeavePlace(); didLeavePlace(); // move to the new place diff --git a/src/java/com/threerings/crowd/client/PlaceController.java b/src/java/com/threerings/crowd/client/PlaceController.java index 7525857d3..9e4ce0364 100644 --- a/src/java/com/threerings/crowd/client/PlaceController.java +++ b/src/java/com/threerings/crowd/client/PlaceController.java @@ -1,5 +1,5 @@ // -// $Id: PlaceController.java,v 1.11 2003/01/09 00:26:56 mdb Exp $ +// $Id: PlaceController.java,v 1.12 2003/01/09 02:46:58 mdb Exp $ package com.threerings.crowd.client; @@ -107,12 +107,14 @@ public abstract class PlaceController extends Controller /** * Called before a request is submitted to the server to leave the - * current place. The request to leave may be rejected, but if a place - * controller needs to make a final communication to the place manager - * before it leaves, it should so do here. This is the only place in - * which the controller is guaranteed to be able to communicate to the - * place manager, as by the time {@link #didLeavePlace} is called, the - * place manager may have already been destroyed. + * current place. As such, this method may be called multiple times + * before {@link #didLeavePlace} is finally called. The request to + * leave may be rejected, but if a place controller needs to flush any + * information to the place manager before it leaves, it should so do + * here. This is the only place in which the controller is guaranteed + * to be able to communicate to the place manager, as by the time + * {@link #didLeavePlace} is called, the place manager may have + * already been destroyed. */ public void mayLeavePlace (final PlaceObject plobj) {