From 0fe363ba65d18bd324396fa1482567bc2db65d1e Mon Sep 17 00:00:00 2001
From: mingchen
Date: Fri, 6 Jun 2008 23:20:02 +0000
Subject: *Made Object Counting correct with linked objects and turned the
previously protected functions that only return object counts to public so it
can be easily used by outside classes.
---
OpenSim/Region/Environment/Scenes/InnerScene.cs | 24 ++++++++++++++----------
OpenSim/Region/Environment/Scenes/Scene.cs | 8 ++++----
2 files changed, 18 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 4c9257d..589d642 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -214,7 +214,7 @@ namespace OpenSim.Region.Environment.Scenes
{
// QuadTree.AddSceneObject(sceneObject);
Entities.Add(sceneObject.UUID, sceneObject);
- m_numPrim++;
+ m_numPrim += sceneObject.Children.Count;
return true;
}
@@ -228,14 +228,18 @@ namespace OpenSim.Region.Environment.Scenes
///
///
/// true if the object was deleted, false if there was no object to delete
- protected internal bool DeleteSceneObject(LLUUID uuid)
+ protected internal bool DeleteSceneObject(LLUUID uuid, bool resultOfObjectLinked)
{
lock (Entities)
{
if (Entities.ContainsKey(uuid))
{
+ Console.WriteLine("REMOVED " + ((SceneObjectGroup)Entities[uuid]).Children.Count + "!");
+ if (!resultOfObjectLinked)
+ {
+ m_numPrim -= ((SceneObjectGroup)Entities[uuid]).Children.Count;
+ }
Entities.Remove(uuid);
- m_numPrim--;
return true;
}
@@ -584,7 +588,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- protected internal int GetChildAgentCount()
+ public int GetChildAgentCount()
{
// some network situations come in where child agents get closed twice.
if (m_numChildAgents < 0)
@@ -595,27 +599,27 @@ namespace OpenSim.Region.Environment.Scenes
return m_numChildAgents;
}
- protected internal int GetRootAgentCount()
+ public int GetRootAgentCount()
{
return m_numRootAgents;
}
- protected internal int GetTotalObjects()
+ public int GetTotalObjectsCount()
{
return m_numPrim;
}
- protected internal int GetActiveObjects()
+ public int GetActiveObjectsCount()
{
return m_physicalPrim;
}
- protected internal int GetActiveScripts()
+ public int GetActiveScriptsCount()
{
return m_activeScripts;
}
- protected internal int GetScriptLPS()
+ public int GetScriptLPS()
{
int returnval = m_scriptLPS;
m_scriptLPS = 0;
@@ -1437,7 +1441,7 @@ namespace OpenSim.Region.Environment.Scenes
// think it's selected, so it will never send a deselect...
copy.IsSelected = false;
- m_numPrim++;
+ m_numPrim += copy.Children.Count;
copy.StartScripts();
copy.ScheduleGroupForFullUpdate();
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 211f320..7d076ef 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -757,13 +757,13 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.AddInPackets(0);
m_statsReporter.SetRootAgents(m_innerScene.GetRootAgentCount());
m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount());
- m_statsReporter.SetObjects(m_innerScene.GetTotalObjects());
- m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjects());
+ m_statsReporter.SetObjects(m_innerScene.GetTotalObjectsCount());
+ m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjectsCount());
frameMS = System.Environment.TickCount - frameMS;
m_statsReporter.addFrameMS(frameMS);
m_statsReporter.addPhysicsMS(physicsMS);
m_statsReporter.addOtherMS(otherMS);
- m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts());
+ m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScriptsCount());
m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS());
}
}
@@ -1412,7 +1412,7 @@ namespace OpenSim.Region.Environment.Scenes
/// true if the object was in the scene, false if it was not
public bool UnlinkSceneObject(LLUUID uuid)
{
- if (m_innerScene.DeleteSceneObject(uuid))
+ if (m_innerScene.DeleteSceneObject(uuid,true))
{
m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID);
--
cgit v1.1