From e19a76377c561df939df512fdaeb6d4e830eb68a Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 21 Jun 2008 20:12:01 +0000 Subject: * Refactor: Fold sog.DeleteParts() functionality into existing sog.DeleteGroup() --- OpenSim/Region/Environment/Scenes/Scene.cs | 3 +-- .../Region/Environment/Scenes/SceneObjectGroup.cs | 28 +++++++--------------- 2 files changed, 9 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index aa74072..4cf1ea4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1670,7 +1670,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void DeleteSceneObject(SceneObjectGroup group) { - SceneObjectPart rootPart = (group).GetChildPart(group.UUID); + SceneObjectPart rootPart = group.GetChildPart(group.UUID); if (rootPart.PhysActor != null) { @@ -1685,7 +1685,6 @@ namespace OpenSim.Region.Environment.Scenes } group.DeleteGroup(); - group.DeleteParts(); } /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 814db05..202e3b8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -931,12 +931,14 @@ namespace OpenSim.Region.Environment.Scenes // code needs a redesign. m_isDeleted = true; - DetachFromBackup(this); + DetachFromBackup(this); lock (m_parts) { foreach (SceneObjectPart part in m_parts.Values) { + part.StopScripts(); + List avatars = Scene.GetScenePresences(); for (int i = 0; i < avatars.Count; i++) { @@ -948,6 +950,9 @@ namespace OpenSim.Region.Environment.Scenes avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); } } + + m_rootPart = null; + m_parts.Clear(); } } @@ -968,23 +973,6 @@ namespace OpenSim.Region.Environment.Scenes } } - /// - /// Delete all the parts in this group. - /// - public void DeleteParts() - { - lock (m_parts) - { - foreach (SceneObjectPart part in m_parts.Values) - { - part.StopScripts(); - } - - m_rootPart = null; - m_parts.Clear(); - } - } - public void AddScriptLPS(int count) { if (scriptScore + count >= float.MaxValue - count) @@ -1793,11 +1781,11 @@ namespace OpenSim.Region.Environment.Scenes m_scene.UnlinkSceneObject(objectGroup.UUID, true); - // TODO Deleting the parts may cause problems later on if they have already + // TODO Deleting the original group object may cause problems later on if they have already // made it into the update queue. However, sending out updates for those parts is now // spurious, so it would be good not to send them at some point. // The traffic caused is always going to be pretty minor, so it's not high priority - //objectGroup.DeleteParts(); + //objectGroup.DeleteGroup(); ScheduleGroupForFullUpdate(); } -- cgit v1.1