From a4a0512011d53a0d8ed64151fd8500481768e2c7 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Mon, 11 Jan 2010 17:28:27 -0800 Subject: [PATCH] Bug in llGetNumberOfPrims always returns to script when no clients are connected to the simulator. --- .../Shared/Api/Implementation/LSL_Api.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 39b597e05d..b9defbe06b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7286,23 +7286,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetNumberOfPrims() { m_host.AddScriptLPS(1); - ScenePresence[] presences = World.GetScenePresences(); - if (presences.Length == 0) - return 0; - int avatarCount = 0; - for (int i = 0; i < presences.Length; i++) + World.ForEachScenePresence(delegate(ScenePresence presence) { - ScenePresence presence = presences[i]; - - if (!presence.IsChildAgent && presence.ParentID != 0) - { - if (m_host.ParentGroup.HasChildPrim(presence.ParentID)) - { + if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) avatarCount++; - } - } - } + }); return m_host.ParentGroup.PrimCount + avatarCount; }