From 7b2b47530e48153b53c00cd33356abbbdb13d0b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Aug 2011 01:16:24 +0100 Subject: move reset code out of HandleMoveToTargetUpdate() so that we only call it where needed instead of passing in a flag --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 28 ++++++++++------------ .../Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b7fa3b6..d471414 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1485,9 +1485,17 @@ namespace OpenSim.Region.Framework.Scenes } // If the user has pressed a key then we want to cancel any move to target. - if (HandleMoveToTargetUpdate( - ref agent_control_v3, bodyRotation, DCFlagKeyPressed, bAllowUpdateMoveToPosition)) + if (DCFlagKeyPressed && m_moveToPositionInProgress) + { + ResetMoveToTarget(); update_movementflag = true; + } + else + { + if (HandleMoveToTargetUpdate( + ref agent_control_v3, bodyRotation, bAllowUpdateMoveToPosition)) + update_movementflag = true; + } } // Cause the avatar to stop flying if it's colliding @@ -1546,27 +1554,15 @@ namespace OpenSim.Region.Framework.Scenes /// /// Cumulative agent movement that this method will update. /// New body rotation of the avatar. - /// If true, clear the move to position /// If true, allow the update in principle. /// True if movement has been updated in some way. False otherwise. public bool HandleMoveToTargetUpdate( - ref Vector3 agent_control_v3, Quaternion bodyRotation, bool reset, bool allowUpdate) + ref Vector3 agent_control_v3, Quaternion bodyRotation, bool allowUpdate) { // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); bool updated = false; - if (reset) - { - if (m_moveToPositionInProgress) - { - ResetMoveToTarget(); - updated = true; - } - - return updated; - } - // m_log.DebugFormat( // "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}", // allowUpdate, m_moveToPositionInProgress, m_autopilotMoving); @@ -1712,7 +1708,7 @@ namespace OpenSim.Region.Framework.Scenes MoveToPositionTarget = pos; Vector3 agent_control_v3 = new Vector3(); - HandleMoveToTargetUpdate(ref agent_control_v3, Rotation, false, true); + HandleMoveToTargetUpdate(ref agent_control_v3, Rotation, true); AddNewMovement(agent_control_v3, Rotation); } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index a0a24f2..fa60653 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -87,7 +87,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC else { Vector3 agent_control_v3 = new Vector3(); - presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation, false, true); + presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation, true); presence.AddNewMovement(agent_control_v3, presence.Rotation); } // -- cgit v1.1