From 49f2bdb493d1d049b69233d615af0606e0e6ed94 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 10 Dec 2008 01:04:05 +0000 Subject: [PATCH] Extract occupant info adding into an overridable method so that derived classes can both participate in the combined event that adds an occupant's info and can coordinate whether their info is added before or after. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5586 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/crowd/server/PlaceManager.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/java/com/threerings/crowd/server/PlaceManager.java b/src/java/com/threerings/crowd/server/PlaceManager.java index 03e305b22..71130ca13 100644 --- a/src/java/com/threerings/crowd/server/PlaceManager.java +++ b/src/java/com/threerings/crowd/server/PlaceManager.java @@ -322,12 +322,7 @@ public class PlaceManager _plobj.startTransaction(); try { - // clone the canonical copy and insert it into the DSet - _plobj.addToOccupantInfo((OccupantInfo)info.clone()); - - // add the body oid to our place object's occupant list - _plobj.addToOccupants(body.getOid()); - + addOccupantInfo((OccupantInfo)info.clone()); } finally { _plobj.commitTransaction(); } @@ -580,6 +575,21 @@ public class PlaceManager } } + /** + * Adds this occupant's info to the {@link PlaceObject}. This is called in a transaction on the + * place object so if a derived class needs to add additional information for an occupant it + * should override this method. It may opt to add the information before calling super if it + * wishes to rely on its information being configured when {@link #bodyAdded} is called. + */ + protected void addOccupantInfo (OccupantInfo info) + { + // clone the canonical copy and insert it into the DSet + _plobj.addToOccupantInfo(info); + + // add the body oid to our place object's occupant list + _plobj.addToOccupants(info.getBodyOid()); + } + /** * Returns whether the location should be marked as empty and potentially shutdown. */