Added calls back into the zone manager to allow it to accept or reject a
zone entry request and for it to be notified when a zone entry is completed. (So that it can do any processing that it might care to do.) git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@957 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
//
|
||||
// $Id: ZoneManager.java,v 1.2 2001/12/13 05:49:50 mdb Exp $
|
||||
// $Id: ZoneManager.java,v 1.3 2002/02/07 03:26:58 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.server;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
import com.threerings.whirled.zone.data.ZoneSummary;
|
||||
|
||||
/**
|
||||
@@ -43,4 +44,29 @@ public interface ZoneManager
|
||||
* is successfully resolved or is known to have failed to resolve.
|
||||
*/
|
||||
public void resolveZone (int zoneId, ResolutionListener listener);
|
||||
|
||||
/**
|
||||
* Called when a body has requested to enter a zone. The zone manager
|
||||
* may return null to indicate that the body is allowed access to the
|
||||
* zone or a string error code indicating the reason for denial of
|
||||
* access (which will be propagated back to the requesting client).
|
||||
* This method is called <em>after</em> the zone is resolved so that
|
||||
* the zone manager may complete the ratification process without
|
||||
* blocking (which it must do).
|
||||
*
|
||||
* @param body the body object of the user that desires access to the
|
||||
* specified zone.
|
||||
* @param zoneId the id of the zone to which the user desires access.
|
||||
*/
|
||||
public String ratifyBodyEntry (BodyObject body, int zoneId);
|
||||
|
||||
/**
|
||||
* Called when a body has been granted access to a zone. This method
|
||||
* must not block.
|
||||
*
|
||||
* @param body the body object of the user that was just granted
|
||||
* access to a zone.
|
||||
* @param zoneId the id of the zone to which they were granted access.
|
||||
*/
|
||||
public void bodyDidEnterZone (BodyObject body, int zoneId);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ZoneProvider.java,v 1.4 2001/12/17 00:56:19 mdb Exp $
|
||||
// $Id: ZoneProvider.java,v 1.5 2002/02/07 03:26:58 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.zone.server;
|
||||
|
||||
@@ -105,6 +105,14 @@ public class ZoneProvider
|
||||
final ZoneSummary fsum = summary;
|
||||
final int fsceneVer = sceneVer;
|
||||
|
||||
// give the zone manager a chance to veto the request
|
||||
ZoneManager zmgr = _zonereg.getZoneManager(summary.zoneId);
|
||||
String errmsg = zmgr.ratifyBodyEntry(source, summary.zoneId);
|
||||
if (errmsg != null) {
|
||||
sendResponse(fsource, finvid, MOVE_FAILED_RESPONSE, errmsg);
|
||||
return;
|
||||
}
|
||||
|
||||
// create a callback object that will handle the resolution or
|
||||
// failed resolution of the scene
|
||||
SceneRegistry.ResolutionListener rl =
|
||||
@@ -162,6 +170,10 @@ public class ZoneProvider
|
||||
new Integer(ploid), config, summary);
|
||||
}
|
||||
|
||||
// let the zone manager know that someone just came on in
|
||||
ZoneManager zmgr = _zonereg.getZoneManager(summary.zoneId);
|
||||
zmgr.bodyDidEnterZone(source, summary.zoneId);
|
||||
|
||||
} catch (ServiceFailedException sfe) {
|
||||
sendResponse(source, invid,
|
||||
MOVE_FAILED_RESPONSE, sfe.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user