Clean up occupant info creation and whatnot. Now we have a nice calldown method

bodyWillEnter() where the PlaceManager can do whatever they want when the body
enters, before or after the occupant info creation process.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5579 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-12-05 22:01:25 +00:00
parent c793aff440
commit 74bccd4223
2 changed files with 13 additions and 37 deletions
@@ -312,32 +312,21 @@ public class PlaceManager
}
/**
* Builds an {@link OccupantInfo} record for the specified body object and inserts it into our
* place object. This is called by the location services when a body enters a place. If a
* derived class wishes to perform custom actions when an occupant is being inserted into a
* room, they should override {@link #insertOccupantInfo}, if they want to react to a body
* having entered, they should override {@link #bodyEntered}.
* This is called to inform the manager that a body is on the way in.
*/
public OccupantInfo buildOccupantInfo (BodyObject body)
public void bodyWillEnter (BodyObject body)
{
try {
// create a new occupant info instance
OccupantInfo info = body.createOccupantInfo(_plobj);
// create a new occupant info instance
OccupantInfo info = body.createOccupantInfo(_plobj);
// insert the occupant info into our canonical table; this is done in a method so that
// derived classes
insertOccupantInfo(info, body);
// insert the occupant info into our canonical table
_occInfo.put(info.getBodyOid(), info);
// clone the canonical copy and insert it into the DSet
_plobj.addToOccupantInfo((OccupantInfo)info.clone());
// clone the canonical copy and insert it into the DSet
_plobj.addToOccupantInfo((OccupantInfo)info.clone());
return info;
} catch (Exception e) {
log.warning("Failure building occupant info [where=" + where() +
", body=" + body + "].", e);
return null;
}
// add the body oid to our place object's occupant list
_plobj.addToOccupants(body.getOid());
}
/**
@@ -538,16 +527,6 @@ public class PlaceManager
cancelShutdowner();
}
/**
* Called when an occupant is being added to this place. This will be before the call to {@link
* #bodyEntered} and gives the derived class a chance to set up additional information about
* the occupant that might not be tracked in the occupant info.
*/
protected void insertOccupantInfo (OccupantInfo info, BodyObject body)
{
_occInfo.put(info.getBodyOid(), info);
}
/**
* Called when a body object enters this place.
*/