From f34cc6b46949033803c79235b9d82da9bf9634dd Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Mon, 5 Apr 2010 22:08:34 +0200
Subject: Add a much cheaper agent count retrieval method. This is obsoleted
by 0.7 so it can be reverted then.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 10 +++++++++-
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ab0d397..e5e6fc9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -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)
{
@@ -4339,6 +4339,14 @@ namespace OpenSim.Region.Framework.Scenes
}
///
+ /// Cheaply return the number of avatars in a region (without fetching a list object)
+ ///
+ public int GetRootAgentCount()
+ {
+ return m_sceneGraph.GetRootAgentCount();
+ }
+
+ ///
/// 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.
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 10ebf67..a76f386 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -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()
--
cgit v1.1