From 3d938f76b7c2f8ede862f9979383d79dfb21372c Mon Sep 17 00:00:00 2001
From: Adam Johnson
Date: Fri, 7 Dec 2007 08:54:31 +0000
Subject: Updates to LibSL revision 1498. Thanks Johan!

---
 .../Framework/Communications/Capabilities/Caps.cs  |  2 +-
 .../Communications/Capabilities/LLSDHelpers.cs     | 18 +++++++------
 .../Capabilities/LLSDStreamHandler.cs              |  6 +++--
 OpenSim/Framework/Util.cs                          |  6 +++++
 OpenSim/Region/ClientStack/ClientView.cs           | 31 ++++++++++------------
 OpenSim/Region/Environment/Modules/ChatModule.cs   |  2 +-
 .../Region/Environment/Modules/WorldCommModule.cs  |  8 +++---
 .../Region/Environment/Scenes/Scene.Inventory.cs   |  4 +--
 .../Region/Environment/Scenes/SceneObjectGroup.cs  |  2 +-
 .../Region/Environment/Scenes/SceneObjectPart.cs   |  2 +-
 OpenSim/Region/Environment/Scenes/ScenePresence.cs | 28 +++++++++----------
 .../Region/Examples/SimpleApp/MyNpcCharacter.cs    | 10 +++----
 12 files changed, 63 insertions(+), 56 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 4603280..f7cb20c 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -258,7 +258,7 @@ namespace OpenSim.Region.Capabilities
         /// <returns></returns>
         public string NoteCardAgentInventory(string request, string path, string param)
         {
-            Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
+            libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request));
             LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
             LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
 
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
index 8252a63..793c366 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.Capabilities
             return sw.ToString();
         }
 
-        public static void SerializeLLSDType(XmlTextWriter writer, object obj)
+        private static void SerializeLLSDType(XmlTextWriter writer, object obj)
         {
             Type myType = obj.GetType();
             LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
@@ -76,7 +76,8 @@ namespace OpenSim.Region.Capabilities
                                 writer.WriteStartElement(String.Empty, "key", String.Empty);
                                 writer.WriteString(fields[i].Name);
                                 writer.WriteEndElement();
-                                LLSD.LLSDWriteOne(writer, fieldValue);
+                                libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
+                                    writer, libsecondlife.StructuredData.LLSD.FromObject(fieldValue));
                             }
                         }
                         writer.WriteEndElement();
@@ -99,11 +100,12 @@ namespace OpenSim.Region.Capabilities
             }
             else
             {
-                LLSD.LLSDWriteOne(writer, obj);
+               libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
+                   writer, libsecondlife.StructuredData.LLSD.FromObject(obj));
             }
         }
-
-        public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
+		
+        public static object DeserialiseLLSDMap(libsecondlife.StructuredData.LLSDMap llsd, object obj)
         {
             Type myType = obj.GetType();
             LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
@@ -118,10 +120,10 @@ namespace OpenSim.Region.Capabilities
                             FieldInfo field = myType.GetField((string) enumerator.Key);
                             if (field != null)
                             {
-                                if (enumerator.Value is Hashtable)
+                                if (enumerator.Value is libsecondlife.StructuredData.LLSDMap)
                                 {
                                     object fieldValue = field.GetValue(obj);
-                                    DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue);
+                                    DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue);
                                 }
                                 else if (enumerator.Value is ArrayList)
                                 {
@@ -143,4 +145,4 @@ namespace OpenSim.Region.Capabilities
             return obj;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
index 08e9563..ed25e71 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
@@ -31,6 +31,7 @@ using System.IO;
 using System.Text;
 using libsecondlife;
 using OpenSim.Framework.Servers;
+using System.Xml;
 
 namespace OpenSim.Region.Capabilities
 {
@@ -53,7 +54,8 @@ namespace OpenSim.Region.Capabilities
             //string requestBody = streamReader.ReadToEnd();
             //streamReader.Close();
 
-            Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
+            libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap) 
+                libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
             TRequest llsdRequest = new TRequest();
             LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
 
@@ -64,4 +66,4 @@ namespace OpenSim.Region.Capabilities
             return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
         }
     }
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index c731561..a9aff60 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -46,6 +46,12 @@ namespace OpenSim.Framework
         private static object XferLock = new object();
         private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
 
+		public static double GetDistanceTo(LLVector3 a, LLVector3 b) {
+			float dx = a.X - b.X;
+			float dy = a.Y - b.Y;
+			float dz = a.Z - b.Z;
+			return Math.Sqrt(dx * dx + dy * dy + dz * dz);
+		}
 
         public static ulong UIntsToLong(uint X, uint Y)
         {
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 284a2de..b2db4cb 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -722,9 +722,11 @@ namespace OpenSim.Region.ClientStack
         /// 
         /// </summary>
         /// <param name="regInfo"></param>
+        private byte[] m_channelVersion=new byte[] { 0x00} ; // Dummy value needed by libSL
         public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
         {
             AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
+            mov.SimData.ChannelVersion = m_channelVersion;
             mov.AgentData.SessionID = m_sessionId;
             mov.AgentData.AgentID = AgentId;
             mov.Data.RegionHandle = regInfo.RegionHandle;
@@ -1170,15 +1172,13 @@ namespace OpenSim.Region.ClientStack
             inventoryReply.InventoryData[0].SaleType = 0;
             inventoryReply.InventoryData[0].Type = (sbyte) item.assetType;
             inventoryReply.InventoryData[0].CRC =
-                Helpers.InventoryCRC(inventoryReply.InventoryData[0].CreationDate, inventoryReply.InventoryData[0].SaleType, 
-                                     inventoryReply.InventoryData[0].InvType,
+                Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType,
                                      inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID,
-                                     inventoryReply.InventoryData[0].GroupID, inventoryReply.InventoryData[0].SalePrice,
+                                     inventoryReply.InventoryData[0].GroupID, 100,
                                      inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID,
                                      inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID,
-                                     inventoryReply.InventoryData[0].EveryoneMask, inventoryReply.InventoryData[0].Flags, 
-                                     inventoryReply.InventoryData[0].NextOwnerMask, inventoryReply.InventoryData[0].GroupMask,
-                                     inventoryReply.InventoryData[0].OwnerMask);
+                                     FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS,
+                                     FULL_MASK_PERMISSIONS);
 
             OutPacket(inventoryReply, ThrottleOutPacketType.Asset);
         }
@@ -1213,16 +1213,13 @@ namespace OpenSim.Region.ClientStack
             InventoryReply.InventoryData[0].SaleType = 0;
             InventoryReply.InventoryData[0].Type = (sbyte) Item.assetType;
             InventoryReply.InventoryData[0].CRC =
-                Helpers.InventoryCRC(InventoryReply.InventoryData[0].CreationDate, InventoryReply.InventoryData[0].SaleType,
-                                     InventoryReply.InventoryData[0].InvType,
+                Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType,
                                      InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID,
-                                     InventoryReply.InventoryData[0].GroupID, InventoryReply.InventoryData[0].SalePrice,
+                                     InventoryReply.InventoryData[0].GroupID, 100,
                                      InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID,
                                      InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID,
-                                     InventoryReply.InventoryData[0].EveryoneMask, InventoryReply.InventoryData[0].Flags,
-                                     InventoryReply.InventoryData[0].NextOwnerMask, InventoryReply.InventoryData[0].GroupMask,
-                                     InventoryReply.InventoryData[0].OwnerMask);
-            
+                                     FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS,
+                                     FULL_MASK_PERMISSIONS);
 
             OutPacket(InventoryReply, ThrottleOutPacketType.Asset);
         }
@@ -1602,7 +1599,6 @@ namespace OpenSim.Region.ClientStack
             outPacket.ObjectData[0].ClickAction = clickAction;
             //outPacket.ObjectData[0].Flags = 0;
             outPacket.ObjectData[0].Radius = 20;
-            
 
             byte[] pb = pos.GetBytes();
             Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
@@ -2904,7 +2900,7 @@ namespace OpenSim.Region.ClientStack
                         {
                             if (OnObjectDescription != null)
                             {
-                                OnObjectDescription(this,objDes.ObjectData[i].LocalID,
+                                OnObjectDescription(this, objDes.ObjectData[i].LocalID,
                                                     enc.GetString(objDes.ObjectData[i].Description));
                             }
                         }
@@ -2915,7 +2911,7 @@ namespace OpenSim.Region.ClientStack
                         {
                             if (OnObjectName != null)
                             {
-                                OnObjectName(this,objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name));
+                                OnObjectName(this, objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name));
                             }
                         }
                         break;
@@ -3003,7 +2999,8 @@ namespace OpenSim.Region.ClientStack
                         // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToStringHyphenated());
                         if (OnAssetUploadRequest != null)
                         {
-                            OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(SecureSessionId),
+                            LLUUID temp=libsecondlife.LLUUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);
+                            OnAssetUploadRequest(this, temp,
                                                  request.AssetBlock.TransactionID, request.AssetBlock.Type,
                                                  request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
                         }
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index c93804f..8af7b49 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules
                                                                      scene.RegionInfo.RegionLocY * 256,
                                                                      0);
                                                              dis =
-                                                                 Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
+                                                                 Math.Abs((int) Util.GetDistanceTo(avatarRegionPos, fromRegionPos));
 
                                                              switch (e.Type)
                                                              {
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index a31b484..0dad998 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Environment.Modules
         {
             m_listenerManager.Remove(handle);
         }
-
+		
         // This method scans nearby objects and determines if they are listeners,
         // and if so if this message fits the filter.  If it does, then
         // enqueue the message for delivery to the objects listen event handler.
@@ -171,9 +171,9 @@ namespace OpenSim.Region.Environment.Modules
                     double dis = 0;
 
                     if (source != null)
-                        dis = sPart.AbsolutePosition.GetDistanceTo(source.AbsolutePosition);
+                        dis = Util.GetDistanceTo(sPart.AbsolutePosition, source.AbsolutePosition);
                     else
-                        dis = sPart.AbsolutePosition.GetDistanceTo(avatar.AbsolutePosition);
+                        dis = Util.GetDistanceTo(sPart.AbsolutePosition, avatar.AbsolutePosition);
 
                     switch (type)
                     {
@@ -490,4 +490,4 @@ namespace OpenSim.Region.Environment.Modules
             return m_id;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 6c8b3bf..ac504e1 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
                         
                         if (transactions != null)
                         {
-                            LLUUID assetID = transactionID.Combine(remoteClient.SecureSessionId);                            
+                            LLUUID assetID = libsecondlife.LLUUID.Combine(transactionID, remoteClient.SecureSessionId);                            
                             AssetBase asset = AssetCache.GetAsset(assetID);
                             
                             if (asset == null)
@@ -432,7 +432,7 @@ namespace OpenSim.Region.Environment.Scenes
                                     ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId),
                                     ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId),
                                     (sbyte) InventoryType.Object,
-                                    (sbyte) AssetType.Object, // TODO: after libSL r1357, this becomes AssetType.Primitive
+                                    (sbyte) AssetType.Primitive,
                                     Helpers.StringToField(sceneObjectXml));
                                 AssetCache.AddAsset(asset);
 
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index bcee5c7..89e2f0d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -675,7 +675,7 @@ namespace OpenSim.Region.Environment.Scenes
         /// </summary>
         public override void Update()
         {
-            if (lastPhysGroupPos.GetDistanceTo(AbsolutePosition) > 0.02)
+            if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
             {
                 foreach (SceneObjectPart part in m_parts.Values)
                 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index bf02e8d..05a59a2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -749,7 +749,7 @@ namespace OpenSim.Region.Environment.Scenes
 
             LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z);
             LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z);
-            float distance = (float)distanceConvert1.GetDistanceTo(distanceConvert2);
+            float distance = (float)Util.GetDistanceTo(distanceConvert1, distanceConvert2);
 
             returnresult.distance = distance;
 
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index b8a2555..66872fa 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -93,12 +93,12 @@ namespace OpenSim.Region.Environment.Scenes
 
         private enum Dir_ControlFlags
         {
-            DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
-            DIR_CONTROL_FLAG_BACK = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG,
-            DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS,
-            DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG,
-            DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS,
-            DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG
+            DIR_CONTROL_FLAG_FOWARD = AgentManager.ControlFlags.AGENT_CONTROL_AT_POS,
+            DIR_CONTROL_FLAG_BACK = AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG,
+            DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS,
+            DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG,
+            DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS,
+            DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG
         }
 
         /// <summary>
@@ -609,7 +609,7 @@ namespace OpenSim.Region.Environment.Scenes
             //MainLog.Instance.Verbose("CAMERA", "AtAxis:" + m_CameraAtAxis.ToString() + " Center:" + m_CameraCenter.ToString() + " LeftAxis:" + m_CameraLeftAxis.ToString() + " UpAxis:" + m_CameraUpAxis.ToString() + " Far:" + m_CameraFar);
            
 
-            if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
+            if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
             {
                 StandUp();
             }
@@ -630,7 +630,7 @@ namespace OpenSim.Region.Environment.Scenes
                 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
                 bool oldflying = PhysicsActor.Flying;
 
-                PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
+                PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
                 if (PhysicsActor.Flying != oldflying)
                 {
                     update_movementflag = true;
@@ -796,7 +796,7 @@ namespace OpenSim.Region.Environment.Scenes
                     }
                     else
                     {
-                        if (((m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
+                        if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
                             PhysicsActor.IsColliding)
                         {
                             SendAnimPack(Animations.AnimsLLUUID["CROUCHWALK"], 1);
@@ -807,7 +807,7 @@ namespace OpenSim.Region.Environment.Scenes
                             {
                                 SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
                             }
-                            else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
+                            else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
                             {
                                 SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
                             }
@@ -839,7 +839,7 @@ namespace OpenSim.Region.Environment.Scenes
                 }
                 else
                 {
-                    if (((m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
+                    if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
                         PhysicsActor.IsColliding)
                     {
                         SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1);
@@ -854,7 +854,7 @@ namespace OpenSim.Region.Environment.Scenes
                         {
                             SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
                         }
-                        else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
+                        else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
                         {
                             SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
                         }
@@ -955,7 +955,7 @@ namespace OpenSim.Region.Environment.Scenes
                         m_updateCount = 0;
                     }
                 }
-                else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02) // physics-related movement
+                else if (Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) // physics-related movement
                 {
                     SendTerseUpdateToAllClients();
                     m_updateCount = 0;
@@ -1123,7 +1123,7 @@ namespace OpenSim.Region.Environment.Scenes
 
         protected void CheckForSignificantMovement()
         {
-            if (AbsolutePosition.GetDistanceTo(posLastSignificantMove) > 0.02)
+            if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.02)
             {
                 posLastSignificantMove = AbsolutePosition;
                 if (OnSignificantClientMovement != null)
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index a3046b0..a9bba3f 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -384,19 +384,19 @@ namespace SimpleApp
             }
             if (flyState == 0)
             {
-                movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
-                               (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG;
+                movementFlag = (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY |
+                               (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG;
                 flyState = 1;
             }
             else if (flyState == 1)
             {
-                movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
-                               (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS;
+                movementFlag = (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY |
+                               (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
                 flyState = 2;
             }
             else
             {
-                movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY;
+                movementFlag = (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY;
                 flyState = 0;
             }
 
-- 
cgit v1.1