From 4fa843ff19441c9daa4e7dae0a4d705f912fca54 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 16 Jan 2014 23:44:17 +0000 Subject: Reorder checks in SP.CompleteMovement() to fix test failures --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 69 ++++++++++++------------ 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 18d84a2..85a20e9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1003,48 +1003,45 @@ namespace OpenSim.Region.Framework.Scenes /// private bool MakeRootAgent(Vector3 pos, bool isFlying) { -// m_log.InfoFormat( -// "[SCENE]: Upgrading child to root agent for {0} in {1}", -// Name, m_scene.RegionInfo.RegionName); - - if (ParentUUID != UUID.Zero) + lock (m_completeMovementLock) { - m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID); - SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID); - if (part == null) + if (!IsChildAgent) + return false; + + //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); + + // m_log.InfoFormat( + // "[SCENE]: Upgrading child to root agent for {0} in {1}", + // Name, m_scene.RegionInfo.RegionName); + + if (ParentUUID != UUID.Zero) { - m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID); + m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID); + SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID); + if (part == null) + { + m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID); + } + else + { + part.ParentGroup.AddAvatar(UUID); + if (part.SitTargetPosition != Vector3.Zero) + part.SitTargetAvatar = UUID; + // ParentPosition = part.GetWorldPosition(); + ParentID = part.LocalId; + ParentPart = part; + m_pos = PrevSitOffset; + // pos = ParentPosition; + pos = part.GetWorldPosition(); + } + ParentUUID = UUID.Zero; + + // Animator.TrySetMovementAnimation("SIT"); } else { - part.ParentGroup.AddAvatar(UUID); - if (part.SitTargetPosition != Vector3.Zero) - part.SitTargetAvatar = UUID; -// ParentPosition = part.GetWorldPosition(); - ParentID = part.LocalId; - ParentPart = part; - m_pos = PrevSitOffset; -// pos = ParentPosition; - pos = part.GetWorldPosition(); + IsLoggingIn = false; } - ParentUUID = UUID.Zero; - - IsChildAgent = false; - -// Animator.TrySetMovementAnimation("SIT"); - } - else - { - IsChildAgent = false; - IsLoggingIn = false; - } - - //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); - - lock (m_completeMovementLock) - { - if (!IsChildAgent) - return false; IsChildAgent = false; } -- cgit v1.1