Added PlaceManager.applyToOccupants(), and a generic useful OccupantOp.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1869 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2002-10-31 01:12:08 +00:00
parent 8252efeed1
commit f1c8ccd347
2 changed files with 34 additions and 1 deletions
@@ -1,10 +1,11 @@
//
// $Id: PlaceManager.java,v 1.39 2002/10/26 02:40:30 shaper Exp $
// $Id: PlaceManager.java,v 1.40 2002/10/31 01:12:08 shaper Exp $
package com.threerings.crowd.server;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;
import com.samskivert.util.HashIntMap;
@@ -102,6 +103,20 @@ public class PlaceManager
return (OccupantInfo)_occInfo.get(bodyOid);
}
/**
* Applies the supplied occupant operation to each occupant currently
* present in this place.
*/
public void applyToOccupants (OccupantOp op)
{
if (_plobj != null) {
Iterator iter = _plobj.occupantInfo.entries();
while (iter.hasNext()) {
op.apply((OccupantInfo)iter.next());
}
}
}
/**
* Updates the occupant info for this room occupant. <em>Note:</em>
* This must be used rather than setting the occupant info directly to