From d34a46eae193d961bd48562bc28747fc010db119 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 27 Jun 2008 14:39:21 +0000
Subject: * refactor: Move responsibility for deciding whether a group should
 be repersisted on to callers of SceneObjectGroup.SendGroupTeruseUpdate()

---
 OpenSim/Region/Environment/Scenes/InnerScene.cs       | 17 ++++++++++++++++-
 OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 12 ++++++++----
 2 files changed, 24 insertions(+), 5 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 5256c9e..6dccf77 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1082,6 +1082,12 @@ namespace OpenSim.Region.Environment.Scenes
             }
         }
 
+        /// <summary>
+        /// Update the position of the given part
+        /// </summary>
+        /// <param name="localID"></param>
+        /// <param name="pos"></param>
+        /// <param name="remoteClient"></param>
         protected internal void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
         {
             SceneObjectGroup group = GetGroupByPrim(localID);
@@ -1093,6 +1099,7 @@ namespace OpenSim.Region.Environment.Scenes
                     group.SendGroupTerseUpdate();
                     return;
                 }
+                
                 if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment)
                 {
                     group.UpdateSinglePosition(pos, localID);
@@ -1101,7 +1108,7 @@ namespace OpenSim.Region.Environment.Scenes
         }
 
         /// <summary>
-        ///
+        /// Update the position of the given part
         /// </summary>
         /// <param name="localID"></param>
         /// <param name="pos"></param>
@@ -1122,6 +1129,7 @@ namespace OpenSim.Region.Environment.Scenes
                     if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment)
                     {
                         group.SendGroupTerseUpdate();
+                        
                         return;
                     }
                         if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment)
@@ -1168,6 +1176,13 @@ namespace OpenSim.Region.Environment.Scenes
             }
         }
 
+        /// <summary>
+        /// Move the given object
+        /// </summary>
+        /// <param name="objectID"></param>
+        /// <param name="offset"></param>
+        /// <param name="pos"></param>
+        /// <param name="remoteClient"></param>
         protected internal void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
         {
             SceneObjectGroup group = GetGroupByPrim(objectID);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index dd9c706..a7c54b3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1588,8 +1588,6 @@ namespace OpenSim.Region.Environment.Scenes
         /// </summary>
         public void SendGroupTerseUpdate()
         {
-            HasGroupChanged = true;
-
             lock (m_parts)
             {
                 foreach (SceneObjectPart part in m_parts.Values)
@@ -2179,7 +2177,7 @@ namespace OpenSim.Region.Environment.Scenes
         #region Position
 
         /// <summary>
-        ///
+        /// Move this scene object
         /// </summary>
         /// <param name="pos"></param>
         public void UpdateGroupPosition(LLVector3 pos)
@@ -2192,20 +2190,24 @@ namespace OpenSim.Region.Environment.Scenes
                 }
 
                 AbsolutePosition = pos;
+                
+                HasGroupChanged = true;
             }
+            
             //we need to do a terse update even if the move wasn't allowed
             // so that the position is reset in the client (the object snaps back)
             ScheduleGroupForTerseUpdate();
         }
 
         /// <summary>
-        ///
+        /// Update the position of a single part of this scene object
         /// </summary>
         /// <param name="pos"></param>
         /// <param name="localID"></param>
         public void UpdateSinglePosition(LLVector3 pos, uint localID)
         {
             SceneObjectPart part = GetChildPart(localID);
+            
             if (part != null)
             {
                 if (part.UUID == m_rootPart.UUID)
@@ -2216,6 +2218,8 @@ namespace OpenSim.Region.Environment.Scenes
                 {
                     part.UpdateOffSet(pos);
                 }
+                
+                HasGroupChanged = true;
             }
         }
 
-- 
cgit v1.1