Added bodyWillLeave() to go with bodyWillEnter() for great symmetry and

justice. Cleaned up some other stuff in the process.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5620 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-01-06 03:08:21 +00:00
parent 0c4665e587
commit 8fcfa6e211
3 changed files with 39 additions and 49 deletions
@@ -312,7 +312,10 @@ public class PlaceManager
}
/**
* This is called to inform the manager that a body is on the way in.
* This is called to inform the manager that a body is on the way in. This is called at the
* very beginning of the entry process before the client is informed that it is allowed to
* enter. This will be followed by a call to {@link #bodyEntered} once all events relating to
* body entry have been processed.
*/
public void bodyWillEnter (BodyObject body)
{
@@ -328,6 +331,23 @@ public class PlaceManager
}
}
/**
* Called to inform a manager that a body is about to leave this place. This will be followed
* by a call to {@link #bodyLeft} once all events relating to body entry have been processed.
*/
public void bodyWillLeave (BodyObject body)
{
_plobj.startTransaction();
try {
// remove their occupant info (which is keyed on oid)
_plobj.removeFromOccupantInfo(body.getOid());
// and remove them from the occupant list
_plobj.removeFromOccupants(body.getOid());
} finally {
_plobj.commitTransaction();
}
}
/**
* Registers a particular message handler instance to be used when processing message events
* with the specified name.