From daf58575f8a8a4610dab833d00b94811732c33cc Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 23 Feb 2012 23:05:04 +0000
Subject: Partially apply the core banlines fix

---
 OpenSim/Region/Framework/Scenes/Scene.cs         |  2 +-
 OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b7162da..fcbed9f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5472,7 +5472,7 @@ Environment.Exit(1);
 //                            presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
 
                     Vector3 agent_control_v3 = new Vector3();
-                    presence.HandleMoveToTargetUpdate(ref agent_control_v3);
+                    presence.HandleMoveToTargetUpdate(1, ref agent_control_v3);
                     presence.AddNewMovement(agent_control_v3);
                 }
             }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 06da741..26fa6c0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1095,7 +1095,7 @@ namespace OpenSim.Region.Framework.Scenes
         }
 
         /// <summary>
-        ///
+        /// Do not call this directly.  Call Scene.RequestTeleportLocation() instead.
         /// </summary>
         /// <param name="pos"></param>
         public void Teleport(Vector3 pos)
@@ -1569,7 +1569,10 @@ namespace OpenSim.Region.Framework.Scenes
                         }
                         else if (bAllowUpdateMoveToPosition)
                         {
-                            if (HandleMoveToTargetUpdate(ref agent_control_v3))
+                            // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a
+                            // certain position.  It's only check for tolerance on returning to that position is 0.2
+                            // rather than 1, at which point it removes its force target.
+                            if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3))
                                 update_movementflag = true;
                         }
                     }
@@ -1631,7 +1634,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// </remarks>
         /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
         /// <returns>True if movement has been updated in some way.  False otherwise.</returns>
-        public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
+        public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3)
         {
 //            m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
 
@@ -1648,7 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes
 //                            Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
 
             // Check the error term of the current position in relation to the target position
-            if (distanceToTarget <= 1)
+            if (distanceToTarget <= tolerance)
             {
                 // We are close enough to the target
                 AbsolutePosition = MoveToPositionTarget;
@@ -1824,7 +1827,7 @@ namespace OpenSim.Region.Framework.Scenes
 //            m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation);
             
             Vector3 agent_control_v3 = new Vector3();
-            HandleMoveToTargetUpdate(ref agent_control_v3);
+            HandleMoveToTargetUpdate(1, ref agent_control_v3);
             AddNewMovement(agent_control_v3);
         }
 
-- 
cgit v1.1