*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.

0.6.0-stable
mingchen 2008-06-06 23:20:02 +00:00
parent bd2361ae33
commit 0fe363ba65
2 changed files with 18 additions and 14 deletions

View File

@ -214,7 +214,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// QuadTree.AddSceneObject(sceneObject); // QuadTree.AddSceneObject(sceneObject);
Entities.Add(sceneObject.UUID, sceneObject); Entities.Add(sceneObject.UUID, sceneObject);
m_numPrim++; m_numPrim += sceneObject.Children.Count;
return true; return true;
} }
@ -228,14 +228,18 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <returns>true if the object was deleted, false if there was no object to delete</returns> /// <returns>true if the object was deleted, false if there was no object to delete</returns>
protected internal bool DeleteSceneObject(LLUUID uuid) protected internal bool DeleteSceneObject(LLUUID uuid, bool resultOfObjectLinked)
{ {
lock (Entities) lock (Entities)
{ {
if (Entities.ContainsKey(uuid)) if (Entities.ContainsKey(uuid))
{ {
Console.WriteLine("REMOVED " + ((SceneObjectGroup)Entities[uuid]).Children.Count + "!");
if (!resultOfObjectLinked)
{
m_numPrim -= ((SceneObjectGroup)Entities[uuid]).Children.Count;
}
Entities.Remove(uuid); Entities.Remove(uuid);
m_numPrim--;
return true; 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. // some network situations come in where child agents get closed twice.
if (m_numChildAgents < 0) if (m_numChildAgents < 0)
@ -595,27 +599,27 @@ namespace OpenSim.Region.Environment.Scenes
return m_numChildAgents; return m_numChildAgents;
} }
protected internal int GetRootAgentCount() public int GetRootAgentCount()
{ {
return m_numRootAgents; return m_numRootAgents;
} }
protected internal int GetTotalObjects() public int GetTotalObjectsCount()
{ {
return m_numPrim; return m_numPrim;
} }
protected internal int GetActiveObjects() public int GetActiveObjectsCount()
{ {
return m_physicalPrim; return m_physicalPrim;
} }
protected internal int GetActiveScripts() public int GetActiveScriptsCount()
{ {
return m_activeScripts; return m_activeScripts;
} }
protected internal int GetScriptLPS() public int GetScriptLPS()
{ {
int returnval = m_scriptLPS; int returnval = m_scriptLPS;
m_scriptLPS = 0; m_scriptLPS = 0;
@ -1437,7 +1441,7 @@ namespace OpenSim.Region.Environment.Scenes
// think it's selected, so it will never send a deselect... // think it's selected, so it will never send a deselect...
copy.IsSelected = false; copy.IsSelected = false;
m_numPrim++; m_numPrim += copy.Children.Count;
copy.StartScripts(); copy.StartScripts();
copy.ScheduleGroupForFullUpdate(); copy.ScheduleGroupForFullUpdate();

View File

@ -757,13 +757,13 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.AddInPackets(0); m_statsReporter.AddInPackets(0);
m_statsReporter.SetRootAgents(m_innerScene.GetRootAgentCount()); m_statsReporter.SetRootAgents(m_innerScene.GetRootAgentCount());
m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount()); m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount());
m_statsReporter.SetObjects(m_innerScene.GetTotalObjects()); m_statsReporter.SetObjects(m_innerScene.GetTotalObjectsCount());
m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjects()); m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjectsCount());
frameMS = System.Environment.TickCount - frameMS; frameMS = System.Environment.TickCount - frameMS;
m_statsReporter.addFrameMS(frameMS); m_statsReporter.addFrameMS(frameMS);
m_statsReporter.addPhysicsMS(physicsMS); m_statsReporter.addPhysicsMS(physicsMS);
m_statsReporter.addOtherMS(otherMS); m_statsReporter.addOtherMS(otherMS);
m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScriptsCount());
m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS());
} }
} }
@ -1412,7 +1412,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns>true if the object was in the scene, false if it was not</returns> /// <returns>true if the object was in the scene, false if it was not</returns>
public bool UnlinkSceneObject(LLUUID uuid) public bool UnlinkSceneObject(LLUUID uuid)
{ {
if (m_innerScene.DeleteSceneObject(uuid)) if (m_innerScene.DeleteSceneObject(uuid,true))
{ {
m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID);