Added mayLeavePlace().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2103 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-01-09 00:26:56 +00:00
parent 125a0c4fef
commit 318d16647f
2 changed files with 33 additions and 2 deletions
@@ -1,5 +1,5 @@
//
// $Id: LocationDirector.java,v 1.27 2002/11/03 01:15:36 mdb Exp $
// $Id: LocationDirector.java,v 1.28 2003/01/09 00:26:56 mdb Exp $
package com.threerings.crowd.client;
@@ -183,6 +183,18 @@ 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);
}
}
// if we have a result listener, let it know if we failed
// or keep it for later if we're still going
if (rl != null) {
@@ -1,5 +1,5 @@
//
// $Id: PlaceController.java,v 1.10 2002/11/08 09:31:59 mdb Exp $
// $Id: PlaceController.java,v 1.11 2003/01/09 00:26:56 mdb Exp $
package com.threerings.crowd.client;
@@ -105,6 +105,25 @@ 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.
*/
public void mayLeavePlace (final PlaceObject plobj)
{
// let our delegates know what's up
applyToDelegates(new DelegateOp() {
public void apply (PlaceControllerDelegate delegate) {
delegate.mayLeavePlace(plobj);
}
});
}
/**
* This is called by the location director when we are leaving this
* place and need to clean up after ourselves and shutdown. Derived