From 2a13e046db0833b2a236179d5ba71c7c8909ed42 Mon Sep 17 00:00:00 2001
From: diva
Date: Wed, 18 Feb 2009 20:10:40 +0000
Subject: Fixes height on Basic Physics in local teleports. Plus some small
 refactoring.

---
 .../Framework/Scenes/SceneCommunicationService.cs       |  3 ++-
 OpenSim/Region/Framework/Scenes/ScenePresence.cs        | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index d0156e1..9060bf2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1195,7 +1195,8 @@ namespace OpenSim.Region.Framework.Scenes
                 }
                 agent.RestoreInCurrentScene();
             }
-            agent.IsInTransit = false;
+            // In any case
+            agent.NotInTransit();
 
             //m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
         }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index df6c97a..fc883db 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -934,6 +934,12 @@ namespace OpenSim.Region.Framework.Scenes
             Velocity = new Vector3(0, 0, 0);
             AbsolutePosition = pos;
             AddToPhysicalScene(isFlying);
+            if (m_appearance != null)
+            {
+                if (m_appearance.AvatarHeight > 0)
+                    SetHeight(m_appearance.AvatarHeight);
+            }
+
             SendTerseUpdateToAllClients();
         }
 
@@ -2438,14 +2444,23 @@ namespace OpenSim.Region.Framework.Scenes
         /// </summary>
         protected void CrossToNewRegion()
         {
+            InTransit();
+            m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying);
+        }
+
+        public void InTransit()
+        {
             m_inTransit = true;
 
             if ((m_physicsActor != null) && m_physicsActor.Flying)
                 m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
             else if ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0)
                 m_AgentControlFlags &= ~(uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
+        }
 
-            m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying);
+        public void NotInTransit()
+        {
+            m_inTransit = false;
         }
 
         public void RestoreInCurrentScene()
-- 
cgit v1.1