mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
Add a much cheaper agent count retrieval method. This is obsoleted by 0.7 so it can be reverted then.
This commit is contained in:
@@ -192,7 +192,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
|
||||
protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
|
||||
{
|
||||
int users = scene.GetAvatars().Count;
|
||||
int users = scene.GetRootAgentCount();
|
||||
int objects = scene.Entities.Count - users;
|
||||
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
int users = s.GetAvatars().Count;
|
||||
int users = s.GetRootAgentCount();
|
||||
rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty);
|
||||
rxw.WriteValue(users);
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
@@ -1523,7 +1523,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void SaveTerrain()
|
||||
{
|
||||
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreWindlightProfile(RegionMeta7WindlightData wl)
|
||||
{
|
||||
@@ -4338,6 +4338,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return m_sceneGraph.GetAvatars();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cheaply return the number of avatars in a region (without fetching a list object)
|
||||
/// </summary>
|
||||
public int GetRootAgentCount()
|
||||
{
|
||||
return m_sceneGraph.GetRootAgentCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a list of all ScenePresences in this region. This returns child agents as well as root agents.
|
||||
/// This list is a new object, so it can be iterated over without locking.
|
||||
|
||||
@@ -5266,7 +5266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_Integer llGetRegionAgentCount()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return new LSL_Integer(World.GetAvatars().Count);
|
||||
return new LSL_Integer(World.GetRootAgentCount());
|
||||
}
|
||||
|
||||
public LSL_Vector llGetRegionCorner()
|
||||
|
||||
Reference in New Issue
Block a user