aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
authorAdam Frisby2008-11-11 17:48:36 +0000
committerAdam Frisby2008-11-11 17:48:36 +0000
commit1493f7349ff60ff4477d40910c6632d6749cb186 (patch)
tree1c7e8e9c880efe3159e3b774d47db4176da30756 /OpenSim/Region/ClientStack/LindenUDP
parent* Implement basic region filtering as described in https://lists.berlios.de/p... (diff)
downloadopensim-SC_OLD-1493f7349ff60ff4477d40910c6632d6749cb186.zip
opensim-SC_OLD-1493f7349ff60ff4477d40910c6632d6749cb186.tar.gz
opensim-SC_OLD-1493f7349ff60ff4477d40910c6632d6749cb186.tar.bz2
opensim-SC_OLD-1493f7349ff60ff4477d40910c6632d6749cb186.tar.xz
* Minor typing fixes in AssetCache - now uses base types for nearly everything.
* Code Cleanliness Fixes in LLClientView * Using field instead of local variable for handlerUpdatePrimGroupRotation (if you notice any new oddities with prim group rotation after this patch, please mantis)
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs132
1 files changed, 51 insertions, 81 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index f9d73d5..06280ca 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -528,8 +528,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
528 KickUserPacket kupack = (KickUserPacket)PacketPool.Instance.GetPacket(PacketType.KickUser); 528 KickUserPacket kupack = (KickUserPacket)PacketPool.Instance.GetPacket(PacketType.KickUser);
529 kupack.UserInfo.AgentID = AgentId; 529 kupack.UserInfo.AgentID = AgentId;
530 kupack.UserInfo.SessionID = SessionId; 530 kupack.UserInfo.SessionID = SessionId;
531 kupack.TargetBlock.TargetIP = (uint)0; 531 kupack.TargetBlock.TargetIP = 0;
532 kupack.TargetBlock.TargetPort = (ushort)0; 532 kupack.TargetBlock.TargetPort = 0;
533 kupack.UserInfo.Reason = Utils.StringToBytes(message); 533 kupack.UserInfo.Reason = Utils.StringToBytes(message);
534 OutPacket(kupack, ThrottleOutPacketType.Task); 534 OutPacket(kupack, ThrottleOutPacketType.Task);
535 // You must sleep here or users get no message! 535 // You must sleep here or users get no message!
@@ -744,7 +744,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
744 744
745 // Ping the client regularly to check that it's still there 745 // Ping the client regularly to check that it's still there
746 m_clientPingTimer = new Timer(5000); 746 m_clientPingTimer = new Timer(5000);
747 m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); 747 m_clientPingTimer.Elapsed += CheckClientConnectivity;
748 m_clientPingTimer.Enabled = true; 748 m_clientPingTimer.Enabled = true;
749 749
750 m_scene.AddNewClient(this, true); 750 m_scene.AddNewClient(this, true);
@@ -765,10 +765,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
765 InitNewClient(); 765 InitNewClient();
766 ClientLoop(); 766 ClientLoop();
767 } 767 }
768 catch (System.Exception e) 768 catch (Exception e)
769 { 769 {
770 if (e is ThreadAbortException) 770 if (e is ThreadAbortException)
771 throw e; 771 throw;
772 772
773 if (StatsManager.SimExtraStats != null) 773 if (StatsManager.SimExtraStats != null)
774 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); 774 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
@@ -798,7 +798,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
798 catch (Exception e2) 798 catch (Exception e2)
799 { 799 {
800 if (e2 is ThreadAbortException) 800 if (e2 is ThreadAbortException)
801 throw e2; 801 throw;
802 802
803 m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2); 803 m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2);
804 } 804 }
@@ -1024,7 +1024,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1024 /// <summary> 1024 /// <summary>
1025 /// 1025 ///
1026 /// </summary> 1026 /// </summary>
1027 /// <param name="regInfo"></param>
1028 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 1027 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
1029 { 1028 {
1030 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); 1029 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
@@ -1130,7 +1129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1130 /// <param name="map">heightmap</param> 1129 /// <param name="map">heightmap</param>
1131 public virtual void SendLayerData(float[] map) 1130 public virtual void SendLayerData(float[] map)
1132 { 1131 {
1133 ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendLayerData), (object)map); 1132 ThreadPool.QueueUserWorkItem(DoSendLayerData, map);
1134 } 1133 }
1135 1134
1136 /// <summary> 1135 /// <summary>
@@ -1161,7 +1160,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1161 } 1160 }
1162 catch (Exception e) 1161 catch (Exception e)
1163 { 1162 {
1164 m_log.Warn("[CLIENT]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); 1163 m_log.Warn("[CLIENT]: ClientView.API.cs: SendLayerData() - Failed with exception " + e);
1165 } 1164 }
1166 } 1165 }
1167 1166
@@ -1251,29 +1250,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1251 } 1250 }
1252 1251
1253 /// <summary> 1252 /// <summary>
1254 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1255 /// </summary>
1256 /// <param name="map">heightmap</param>
1257 /// <param name="px">X coordinate for patches 0..12</param>
1258 /// <param name="py">Y coordinate for patches 0..15</param>
1259 // private void SendLayerPacket(float[] map, int y, int x)
1260 // {
1261 // int[] patches = new int[4];
1262 // patches[0] = x + 0 + y * 16;
1263 // patches[1] = x + 1 + y * 16;
1264 // patches[2] = x + 2 + y * 16;
1265 // patches[3] = x + 3 + y * 16;
1266
1267 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
1268 // OutPacket(layerpack, ThrottleOutPacketType.Land);
1269 // }
1270
1271 /// <summary>
1272 /// Tell the client that the given neighbour region is ready to receive a child agent. 1253 /// Tell the client that the given neighbour region is ready to receive a child agent.
1273 /// </summary> 1254 /// </summary>
1274 /// <param name="neighbourHandle"></param>
1275 /// <param name="neighbourIP"></param>
1276 /// <param name="neighbourPort"></param>
1277 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) 1255 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint)
1278 { 1256 {
1279 IPAddress neighbourIP = neighbourEndPoint.Address; 1257 IPAddress neighbourIP = neighbourEndPoint.Address;
@@ -1705,7 +1683,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1705 1683
1706 public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item) 1684 public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
1707 { 1685 {
1708 uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; 1686 const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
1687
1709 FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply); 1688 FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
1710 // TODO: don't create new blocks if recycling an old packet 1689 // TODO: don't create new blocks if recycling an old packet
1711 inventoryReply.AgentData.AgentID = AgentId; 1690 inventoryReply.AgentData.AgentID = AgentId;
@@ -1750,7 +1729,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1750 /// <see>IClientAPI.SendBulkUpdateInventory(InventoryItemBase)</see> 1729 /// <see>IClientAPI.SendBulkUpdateInventory(InventoryItemBase)</see>
1751 public void SendBulkUpdateInventory(InventoryItemBase item) 1730 public void SendBulkUpdateInventory(InventoryItemBase item)
1752 { 1731 {
1753 uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; 1732 const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
1754 1733
1755 BulkUpdateInventoryPacket bulkUpdate 1734 BulkUpdateInventoryPacket bulkUpdate
1756 = (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory); 1735 = (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory);
@@ -1805,7 +1784,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1805 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> 1784 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
1806 public void SendInventoryItemCreateUpdate(InventoryItemBase Item) 1785 public void SendInventoryItemCreateUpdate(InventoryItemBase Item)
1807 { 1786 {
1808 uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; 1787 const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
1809 1788
1810 UpdateCreateInventoryItemPacket InventoryReply 1789 UpdateCreateInventoryItemPacket InventoryReply
1811 = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket( 1790 = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(
@@ -2295,11 +2274,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2295 /// Send a terse positional/rotation/velocity update about an avatar to the client. This avatar can be that of 2274 /// Send a terse positional/rotation/velocity update about an avatar to the client. This avatar can be that of
2296 /// the client itself. 2275 /// the client itself.
2297 /// </summary> 2276 /// </summary>
2298 /// <param name="regionHandle"></param>
2299 /// <param name="timeDilation"></param>
2300 /// <param name="localID"></param>
2301 /// <param name="position"></param>
2302 /// <param name="velocity"></param>
2303 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, 2277 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
2304 Vector3 velocity, Quaternion rotation) 2278 Vector3 velocity, Quaternion rotation)
2305 { 2279 {
@@ -2690,7 +2664,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2690 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 2664 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
2691 packet.AgentData.TransactionID = UUID.Random(); 2665 packet.AgentData.TransactionID = UUID.Random();
2692 packet.AgentData.AgentID = AgentId; 2666 packet.AgentData.AgentID = AgentId;
2693 packet.AgentData.SessionID = this.SessionId; 2667 packet.AgentData.SessionID = SessionId;
2694 packet.MethodData.Invoice = invoice; 2668 packet.MethodData.Invoice = invoice;
2695 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 2669 packet.MethodData.Method = Utils.StringToBytes("setaccess");
2696 2670
@@ -2714,7 +2688,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2714 } 2688 }
2715 packet.ParamList = returnblock; 2689 packet.ParamList = returnblock;
2716 packet.Header.Reliable = false; 2690 packet.Header.Reliable = false;
2717 this.OutPacket(packet, ThrottleOutPacketType.Task); 2691 OutPacket(packet, ThrottleOutPacketType.Task);
2718 } 2692 }
2719 2693
2720 public void SendBannedUserList(UUID invoice, EstateBan[] bl, uint estateID) 2694 public void SendBannedUserList(UUID invoice, EstateBan[] bl, uint estateID)
@@ -2733,7 +2707,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2733 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 2707 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
2734 packet.AgentData.TransactionID = UUID.Random(); 2708 packet.AgentData.TransactionID = UUID.Random();
2735 packet.AgentData.AgentID = AgentId; 2709 packet.AgentData.AgentID = AgentId;
2736 packet.AgentData.SessionID = this.SessionId; 2710 packet.AgentData.SessionID = SessionId;
2737 packet.MethodData.Invoice = invoice; 2711 packet.MethodData.Invoice = invoice;
2738 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 2712 packet.MethodData.Method = Utils.StringToBytes("setaccess");
2739 2713
@@ -2758,7 +2732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2758 } 2732 }
2759 packet.ParamList = returnblock; 2733 packet.ParamList = returnblock;
2760 packet.Header.Reliable = false; 2734 packet.Header.Reliable = false;
2761 this.OutPacket(packet, ThrottleOutPacketType.Task); 2735 OutPacket(packet, ThrottleOutPacketType.Task);
2762 } 2736 }
2763 2737
2764 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) 2738 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
@@ -2766,7 +2740,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2766 RegionInfoPacket rinfopack = new RegionInfoPacket(); 2740 RegionInfoPacket rinfopack = new RegionInfoPacket();
2767 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock(); 2741 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock();
2768 rinfopack.AgentData.AgentID = AgentId; 2742 rinfopack.AgentData.AgentID = AgentId;
2769 rinfopack.AgentData.SessionID = this.SessionId; 2743 rinfopack.AgentData.SessionID = SessionId;
2770 rinfoblk.BillableFactor = args.billableFactor; 2744 rinfoblk.BillableFactor = args.billableFactor;
2771 rinfoblk.EstateID = args.estateID; 2745 rinfoblk.EstateID = args.estateID;
2772 rinfoblk.MaxAgents = args.maxAgents; 2746 rinfoblk.MaxAgents = args.maxAgents;
@@ -2786,7 +2760,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2786 2760
2787 rinfopack.RegionInfo = rinfoblk; 2761 rinfopack.RegionInfo = rinfoblk;
2788 2762
2789 this.OutPacket(rinfopack, ThrottleOutPacketType.Task); 2763 OutPacket(rinfopack, ThrottleOutPacketType.Task);
2790 } 2764 }
2791 2765
2792 public void SendEstateCovenantInformation(UUID covenant) 2766 public void SendEstateCovenantInformation(UUID covenant)
@@ -2801,7 +2775,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2801 edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 2775 edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
2802 edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName); 2776 edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName);
2803 einfopack.Data = edata; 2777 einfopack.Data = edata;
2804 this.OutPacket(einfopack, ThrottleOutPacketType.Task); 2778 OutPacket(einfopack, ThrottleOutPacketType.Task);
2805 } 2779 }
2806 2780
2807 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) 2781 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
@@ -2835,7 +2809,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2835 packet.ParamList = returnblock; 2809 packet.ParamList = returnblock;
2836 packet.Header.Reliable = false; 2810 packet.Header.Reliable = false;
2837 //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString()); 2811 //System.Console.WriteLine("[ESTATE]: SIM--->" + packet.ToString());
2838 this.OutPacket(packet, ThrottleOutPacketType.Task); 2812 OutPacket(packet, ThrottleOutPacketType.Task);
2839 } 2813 }
2840 2814
2841 #endregion 2815 #endregion
@@ -2844,13 +2818,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2844 2818
2845 public void SendLandParcelOverlay(byte[] data, int sequence_id) 2819 public void SendLandParcelOverlay(byte[] data, int sequence_id)
2846 { 2820 {
2847 2821 ParcelOverlayPacket packet = (ParcelOverlayPacket)PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
2848 ParcelOverlayPacket packet;
2849 packet = (ParcelOverlayPacket)PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
2850 packet.ParcelData.Data = data; 2822 packet.ParcelData.Data = data;
2851 packet.ParcelData.SequenceID = sequence_id; 2823 packet.ParcelData.SequenceID = sequence_id;
2852 packet.Header.Zerocoded = true; 2824 packet.Header.Zerocoded = true;
2853 this.OutPacket(packet, ThrottleOutPacketType.Task); 2825 OutPacket(packet, ThrottleOutPacketType.Task);
2854 } 2826 }
2855 2827
2856 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) 2828 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
@@ -2873,7 +2845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2873 updatePacket.ParcelData.GroupID = landData.GroupID; 2845 updatePacket.ParcelData.GroupID = landData.GroupID;
2874 updatePacket.ParcelData.GroupPrims = landData.GroupPrims; 2846 updatePacket.ParcelData.GroupPrims = landData.GroupPrims;
2875 updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; 2847 updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned;
2876 updatePacket.ParcelData.LandingType = (byte)landData.LandingType; 2848 updatePacket.ParcelData.LandingType = landData.LandingType;
2877 updatePacket.ParcelData.LocalID = landData.LocalID; 2849 updatePacket.ParcelData.LocalID = landData.LocalID;
2878 2850
2879 if (landData.Area > 0) 2851 if (landData.Area > 0)
@@ -2934,7 +2906,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2934 updatePacket.ParcelData.UserLookAt = landData.UserLookAt; 2906 updatePacket.ParcelData.UserLookAt = landData.UserLookAt;
2935 updatePacket.Header.Zerocoded = true; 2907 updatePacket.Header.Zerocoded = true;
2936 2908
2937 OutPacket((Packet)updatePacket, ThrottleOutPacketType.Task); 2909 OutPacket(updatePacket, ThrottleOutPacketType.Task);
2938 } 2910 }
2939 2911
2940 public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) 2912 public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
@@ -2956,13 +2928,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2956 2928
2957 replyPacket.List = list.ToArray(); 2929 replyPacket.List = list.ToArray();
2958 replyPacket.Header.Zerocoded = true; 2930 replyPacket.Header.Zerocoded = true;
2959 this.OutPacket((Packet)replyPacket, ThrottleOutPacketType.Task); 2931 OutPacket(replyPacket, ThrottleOutPacketType.Task);
2960 } 2932 }
2961 2933
2962 public void SendForceClientSelectObjects(List<uint> ObjectIDs) 2934 public void SendForceClientSelectObjects(List<uint> ObjectIDs)
2963 { 2935 {
2964 bool firstCall = true; 2936 bool firstCall = true;
2965 int MAX_OBJECTS_PER_PACKET = 251; 2937 const int MAX_OBJECTS_PER_PACKET = 251;
2966 ForceObjectSelectPacket pack = (ForceObjectSelectPacket)PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); 2938 ForceObjectSelectPacket pack = (ForceObjectSelectPacket)PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
2967 ForceObjectSelectPacket.DataBlock[] data; 2939 ForceObjectSelectPacket.DataBlock[] data;
2968 while (ObjectIDs.Count > 0) 2940 while (ObjectIDs.Count > 0)
@@ -2995,7 +2967,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2995 } 2967 }
2996 pack.Data = data; 2968 pack.Data = data;
2997 pack.Header.Zerocoded = true; 2969 pack.Header.Zerocoded = true;
2998 this.OutPacket((Packet)pack, ThrottleOutPacketType.Task); 2970 OutPacket(pack, ThrottleOutPacketType.Task);
2999 } 2971 }
3000 } 2972 }
3001 2973
@@ -3070,21 +3042,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3070 byte[] pb = pos.GetBytes(); 3042 byte[] pb = pos.GetBytes();
3071 Array.Copy(pb, 0, bytes, i, pb.Length); 3043 Array.Copy(pb, 0, bytes, i, pb.Length);
3072 i += 12; 3044 i += 12;
3073 ushort InternVelocityX;
3074 ushort InternVelocityY;
3075 ushort InternVelocityZ;
3076 Vector3 internDirec = new Vector3(0, 0, 0);
3077 3045
3078 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); 3046 Vector3 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z);
3079 3047
3080 internDirec = internDirec / 128.0f; 3048 internDirec = internDirec / 128.0f;
3081 internDirec.X += 1; 3049 internDirec.X += 1;
3082 internDirec.Y += 1; 3050 internDirec.Y += 1;
3083 internDirec.Z += 1; 3051 internDirec.Z += 1;
3084 3052
3085 InternVelocityX = (ushort)(32768 * internDirec.X); 3053 ushort InternVelocityX = (ushort)(32768 * internDirec.X);
3086 InternVelocityY = (ushort)(32768 * internDirec.Y); 3054 ushort InternVelocityY = (ushort)(32768 * internDirec.Y);
3087 InternVelocityZ = (ushort)(32768 * internDirec.Z); 3055 ushort InternVelocityZ = (ushort)(32768 * internDirec.Z);
3088 3056
3089 ushort ac = 32767; 3057 ushort ac = 32767;
3090 bytes[i++] = (byte)(InternVelocityX % 256); 3058 bytes[i++] = (byte)(InternVelocityX % 256);
@@ -3208,7 +3176,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3208 bytes[i++] = (byte)((rw >> 8) % 256); 3176 bytes[i++] = (byte)((rw >> 8) % 256);
3209 3177
3210 //rotation vel 3178 //rotation vel
3211 ushort rvelx, rvely, rvelz;
3212 Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z); 3179 Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z);
3213 3180
3214 rvel = rvel / 128.0f; 3181 rvel = rvel / 128.0f;
@@ -3216,9 +3183,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3216 rvel.Y += 1; 3183 rvel.Y += 1;
3217 rvel.Z += 1; 3184 rvel.Z += 1;
3218 //vel 3185 //vel
3219 rvelx = (ushort)(32768 * (rvel.X)); 3186 ushort rvelx = (ushort)(32768 * (rvel.X));
3220 rvely = (ushort)(32768 * (rvel.Y)); 3187 ushort rvely = (ushort)(32768 * (rvel.Y));
3221 rvelz = (ushort)(32768 * (rvel.Z)); 3188 ushort rvelz = (ushort)(32768 * (rvel.Z));
3222 3189
3223 bytes[i++] = (byte)(rvelx % 256); 3190 bytes[i++] = (byte)(rvelx % 256);
3224 bytes[i++] = (byte)((rvelx >> 8) % 256); 3191 bytes[i++] = (byte)((rvelx >> 8) % 256);
@@ -3540,15 +3507,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3540 { 3507 {
3541 XmlDocument doc = new XmlDocument(); 3508 XmlDocument doc = new XmlDocument();
3542 doc.Load(reader); 3509 doc.Load(reader);
3543 foreach (XmlNode nod in doc.DocumentElement.ChildNodes) 3510 if (doc.DocumentElement != null)
3544 { 3511 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
3545 if (nod.Attributes["name"] != null)
3546 { 3512 {
3547 string name = nod.Attributes["name"].Value.ToLower(); 3513 if (nod.Attributes["name"] != null)
3548 string id = nod.InnerText; 3514 {
3549 m_defaultAnimations.Add(name, (UUID)id); 3515 string name = nod.Attributes["name"].Value.ToLower();
3516 string id = nod.InnerText;
3517 m_defaultAnimations.Add(name, (UUID)id);
3518 }
3550 } 3519 }
3551 }
3552 } 3520 }
3553 } 3521 }
3554 3522
@@ -3651,7 +3619,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3651 else 3619 else
3652 { 3620 {
3653 // UUID partId = part.UUID; 3621 // UUID partId = part.UUID;
3654 UpdatePrimRotation handlerUpdatePrimRotation;
3655 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; 3622 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
3656 3623
3657 switch (block.Type) 3624 switch (block.Type)
@@ -3914,10 +3881,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3914 float locx; 3881 float locx;
3915 float locy; 3882 float locy;
3916 float locz; 3883 float locz;
3917 uint regionX; 3884
3918 uint regionY;
3919 try 3885 try
3920 { 3886 {
3887 uint regionX;
3888 uint regionY;
3921 Helpers.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY); 3889 Helpers.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY);
3922 locx = Convert.ToSingle(Utils.BytesToString(gmParams[0].Parameter)) - regionX; 3890 locx = Convert.ToSingle(Utils.BytesToString(gmParams[0].Parameter)) - regionX;
3923 locy = Convert.ToSingle(Utils.BytesToString(gmParams[1].Parameter)) - regionY; 3891 locy = Convert.ToSingle(Utils.BytesToString(gmParams[1].Parameter)) - regionY;
@@ -4676,10 +4644,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4676 if (handlerUpdatePrimFlags != null) 4644 if (handlerUpdatePrimFlags != null)
4677 { 4645 {
4678 byte[] data = Pack.ToBytes(); 4646 byte[] data = Pack.ToBytes();
4679 int i = 46; 4647 // 46,47,48 are special positions within the packet
4680 bool UsePhysics = (data[i++] != 0) ? true : false; 4648 // This may change so perhaps we need a better way
4681 bool IsTemporary = (data[i++] != 0) ? true : false; 4649 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
4682 bool IsPhantom = (data[i++] != 0) ? true : false; 4650 bool UsePhysics = (data[46] != 0) ? true : false;
4651 bool IsTemporary = (data[47] != 0) ? true : false;
4652 bool IsPhantom = (data[48] != 0) ? true : false;
4683 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); 4653 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
4684 } 4654 }
4685 break; 4655 break;