aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-30 06:18:17 +0000
committerTeravus Ovares2007-12-30 06:18:17 +0000
commit32438ab1b9a5c270e0a4a2d708f8c7730dc7e617 (patch)
tree21595ce38d7a9474c1b3f3eb71c8d50a2763039a
parent* Applied Melanie's same instance IM fix. This will make IMs work within the... (diff)
downloadopensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.zip
opensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.tar.gz
opensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.tar.bz2
opensim-SC_OLD-32438ab1b9a5c270e0a4a2d708f8c7730dc7e617.tar.xz
* This update rolls back the packetpool and LibSL changes. Please retest and then patch these changes back in. Currently it's not quite ready for 0.5. The down side to this action, is that we loose some performance to the garbage collector for now. Given that the target date for 0.5 is *Two days* from now, I'm taking the initiative to work towards a real stable version.
* This update also fixes scripting and some weird physics reactions
-rw-r--r--OpenSim/Framework/ClientManager.cs3
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs178
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs10
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs76
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs18
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs16
-rw-r--r--bin/libsecondlife.dllbin5317632 -> 1560576 bytes
12 files changed, 159 insertions, 169 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 181000c..f464015 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -148,8 +148,7 @@ namespace OpenSim.Framework
148 148
149 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) 149 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
150 { 150 {
151 ViewerEffectPacket packet = (ViewerEffectPacket) PacketPool.Instance.GetPacket(PacketType.ViewerEffect); 151 ViewerEffectPacket packet = new ViewerEffectPacket();
152 // TODO: don't create new blocks if recycling an old packet
153 packet.Effect = effectBlock; 152 packet.Effect = effectBlock;
154 153
155 // Wasteful, I know 154 // Wasteful, I know
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 932414d..8bf807c 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack
216 { 216 {
217 m_scene.RemoveClient(AgentId); 217 m_scene.RemoveClient(AgentId);
218 // Send the STOP packet 218 // Send the STOP packet
219 DisableSimulatorPacket disable = (DisableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 219 DisableSimulatorPacket disable = new DisableSimulatorPacket();
220 OutPacket(disable, ThrottleOutPacketType.Task); 220 OutPacket(disable, ThrottleOutPacketType.Task);
221 221
222 222
@@ -257,7 +257,7 @@ namespace OpenSim.Region.ClientStack
257 257
258 public void Kick(string message) 258 public void Kick(string message)
259 { 259 {
260 KickUserPacket kupack = (KickUserPacket) PacketPool.Instance.GetPacket(PacketType.KickUser); 260 KickUserPacket kupack = new KickUserPacket();
261 kupack.UserInfo.AgentID = AgentId; 261 kupack.UserInfo.AgentID = AgentId;
262 kupack.UserInfo.SessionID = SessionId; 262 kupack.UserInfo.SessionID = SessionId;
263 kupack.TargetBlock.TargetIP = (uint) 0; 263 kupack.TargetBlock.TargetIP = (uint) 0;
@@ -596,7 +596,7 @@ namespace OpenSim.Region.ClientStack
596 /// <param name="regInfo"></param> 596 /// <param name="regInfo"></param>
597 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) 597 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
598 { 598 {
599 AgentMovementCompletePacket mov = (AgentMovementCompletePacket) PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); 599 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
600 mov.SimData.ChannelVersion = m_channelVersion; 600 mov.SimData.ChannelVersion = m_channelVersion;
601 mov.AgentData.SessionID = m_sessionId; 601 mov.AgentData.SessionID = m_sessionId;
602 mov.AgentData.AgentID = AgentId; 602 mov.AgentData.AgentID = AgentId;
@@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack
631 631
632 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 632 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
633 { 633 {
634 ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); 634 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
635 reply.ChatData.Audible = 1; 635 reply.ChatData.Audible = 1;
636 reply.ChatData.Message = message; 636 reply.ChatData.Message = message;
637 reply.ChatData.ChatType = type; 637 reply.ChatData.ChatType = type;
@@ -652,7 +652,7 @@ namespace OpenSim.Region.ClientStack
652 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, 652 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
653 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) 653 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
654 { 654 {
655 ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); 655 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
656 msg.AgentData.AgentID = fromAgent; 656 msg.AgentData.AgentID = fromAgent;
657 msg.AgentData.SessionID = fromAgentSession; 657 msg.AgentData.SessionID = fromAgentSession;
658 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName); 658 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
@@ -740,7 +740,7 @@ namespace OpenSim.Region.ClientStack
740 IPAddress neighbourIP = neighbourEndPoint.Address; 740 IPAddress neighbourIP = neighbourEndPoint.Address;
741 ushort neighbourPort = (ushort) neighbourEndPoint.Port; 741 ushort neighbourPort = (ushort) neighbourEndPoint.Port;
742 742
743 EnableSimulatorPacket enablesimpacket = (EnableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.EnableSimulator); 743 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
744 // TODO: don't create new blocks if recycling an old packet 744 // TODO: don't create new blocks if recycling an old packet
745 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 745 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
746 enablesimpacket.SimulatorInfo.Handle = neighbourHandle; 746 enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
@@ -777,7 +777,7 @@ namespace OpenSim.Region.ClientStack
777 { 777 {
778 LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10); 778 LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10);
779 779
780 CrossedRegionPacket newSimPack = (CrossedRegionPacket) PacketPool.Instance.GetPacket(PacketType.CrossedRegion); 780 CrossedRegionPacket newSimPack = new CrossedRegionPacket();
781 // TODO: don't create new blocks if recycling an old packet 781 // TODO: don't create new blocks if recycling an old packet
782 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); 782 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
783 newSimPack.AgentData.AgentID = AgentId; 783 newSimPack.AgentData.AgentID = AgentId;
@@ -800,7 +800,7 @@ namespace OpenSim.Region.ClientStack
800 800
801 public void SendMapBlock(List<MapBlockData> mapBlocks) 801 public void SendMapBlock(List<MapBlockData> mapBlocks)
802 { 802 {
803 MapBlockReplyPacket mapReply = (MapBlockReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapBlockReply); 803 MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
804 // TODO: don't create new blocks if recycling an old packet 804 // TODO: don't create new blocks if recycling an old packet
805 mapReply.AgentData.AgentID = AgentId; 805 mapReply.AgentData.AgentID = AgentId;
806 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; 806 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
@@ -823,7 +823,7 @@ namespace OpenSim.Region.ClientStack
823 823
824 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) 824 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
825 { 825 {
826 TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal); 826 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
827 tpLocal.Info.AgentID = AgentId; 827 tpLocal.Info.AgentID = AgentId;
828 tpLocal.Info.TeleportFlags = flags; 828 tpLocal.Info.TeleportFlags = flags;
829 tpLocal.Info.LocationID = 2; 829 tpLocal.Info.LocationID = 2;
@@ -835,7 +835,7 @@ namespace OpenSim.Region.ClientStack
835 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, 835 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID,
836 uint flags, string capsURL) 836 uint flags, string capsURL)
837 { 837 {
838 TeleportFinishPacket teleport = (TeleportFinishPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFinish); 838 TeleportFinishPacket teleport = new TeleportFinishPacket();
839 teleport.Info.AgentID = AgentId; 839 teleport.Info.AgentID = AgentId;
840 teleport.Info.RegionHandle = regionHandle; 840 teleport.Info.RegionHandle = regionHandle;
841 teleport.Info.SimAccess = simAccess; 841 teleport.Info.SimAccess = simAccess;
@@ -861,7 +861,7 @@ namespace OpenSim.Region.ClientStack
861 /// </summary> 861 /// </summary>
862 public void SendTeleportFailed() 862 public void SendTeleportFailed()
863 { 863 {
864 TeleportFailedPacket tpFailed = (TeleportFailedPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFailed); 864 TeleportFailedPacket tpFailed = new TeleportFailedPacket();
865 tpFailed.Info.AgentID = AgentId; 865 tpFailed.Info.AgentID = AgentId;
866 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); 866 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
867 OutPacket(tpFailed, ThrottleOutPacketType.Task); 867 OutPacket(tpFailed, ThrottleOutPacketType.Task);
@@ -872,14 +872,14 @@ namespace OpenSim.Region.ClientStack
872 /// </summary> 872 /// </summary>
873 public void SendTeleportLocationStart() 873 public void SendTeleportLocationStart()
874 { 874 {
875 TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart); 875 TeleportStartPacket tpStart = new TeleportStartPacket();
876 tpStart.Info.TeleportFlags = 16; // Teleport via location 876 tpStart.Info.TeleportFlags = 16; // Teleport via location
877 OutPacket(tpStart, ThrottleOutPacketType.Task); 877 OutPacket(tpStart, ThrottleOutPacketType.Task);
878 } 878 }
879 879
880 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) 880 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
881 { 881 {
882 MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket) PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply); 882 MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket();
883 money.MoneyData.AgentID = AgentId; 883 money.MoneyData.AgentID = AgentId;
884 money.MoneyData.TransactionID = transaction; 884 money.MoneyData.TransactionID = transaction;
885 money.MoneyData.TransactionSuccess = success; 885 money.MoneyData.TransactionSuccess = success;
@@ -890,7 +890,7 @@ namespace OpenSim.Region.ClientStack
890 890
891 public void SendStartPingCheck(byte seq) 891 public void SendStartPingCheck(byte seq)
892 { 892 {
893 StartPingCheckPacket pc = (StartPingCheckPacket) PacketPool.Instance.GetPacket(PacketType.StartPingCheck); 893 StartPingCheckPacket pc = new StartPingCheckPacket();
894 pc.PingID.PingID = seq; 894 pc.PingID.PingID = seq;
895 pc.Header.Reliable = false; 895 pc.Header.Reliable = false;
896 OutPacket(pc, ThrottleOutPacketType.Task); 896 OutPacket(pc, ThrottleOutPacketType.Task);
@@ -898,7 +898,7 @@ namespace OpenSim.Region.ClientStack
898 898
899 public void SendKillObject(ulong regionHandle, uint localID) 899 public void SendKillObject(ulong regionHandle, uint localID)
900 { 900 {
901 KillObjectPacket kill = (KillObjectPacket) PacketPool.Instance.GetPacket(PacketType.KillObject); 901 KillObjectPacket kill = new KillObjectPacket();
902 // TODO: don't create new blocks if recycling an old packet 902 // TODO: don't create new blocks if recycling an old packet
903 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 903 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
904 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 904 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
@@ -1092,7 +1092,7 @@ namespace OpenSim.Region.ClientStack
1092 1092
1093 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) 1093 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)
1094 { 1094 {
1095 InventoryDescendentsPacket descend = (InventoryDescendentsPacket) PacketPool.Instance.GetPacket(PacketType.InventoryDescendents); 1095 InventoryDescendentsPacket descend = new InventoryDescendentsPacket();
1096 descend.AgentData.AgentID = AgentId; 1096 descend.AgentData.AgentID = AgentId;
1097 descend.AgentData.OwnerID = ownerID; 1097 descend.AgentData.OwnerID = ownerID;
1098 descend.AgentData.FolderID = folderID; 1098 descend.AgentData.FolderID = folderID;
@@ -1105,7 +1105,7 @@ namespace OpenSim.Region.ClientStack
1105 { 1105 {
1106 Encoding enc = Encoding.ASCII; 1106 Encoding enc = Encoding.ASCII;
1107 uint FULL_MASK_PERMISSIONS = 2147483647; 1107 uint FULL_MASK_PERMISSIONS = 2147483647;
1108 FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket) PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply); 1108 FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket();
1109 // TODO: don't create new blocks if recycling an old packet 1109 // TODO: don't create new blocks if recycling an old packet
1110 inventoryReply.AgentData.AgentID = AgentId; 1110 inventoryReply.AgentData.AgentID = AgentId;
1111 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; 1111 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
@@ -1147,7 +1147,7 @@ namespace OpenSim.Region.ClientStack
1147 { 1147 {
1148 Encoding enc = Encoding.ASCII; 1148 Encoding enc = Encoding.ASCII;
1149 uint FULL_MASK_PERMISSIONS = 2147483647; 1149 uint FULL_MASK_PERMISSIONS = 2147483647;
1150 UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem); 1150 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
1151 // TODO: don't create new blocks if recycling an old packet 1151 // TODO: don't create new blocks if recycling an old packet
1152 InventoryReply.AgentData.AgentID = AgentId; 1152 InventoryReply.AgentData.AgentID = AgentId;
1153 InventoryReply.AgentData.SimApproved = true; 1153 InventoryReply.AgentData.SimApproved = true;
@@ -1186,7 +1186,7 @@ namespace OpenSim.Region.ClientStack
1186 1186
1187 public void SendRemoveInventoryItem(LLUUID itemID) 1187 public void SendRemoveInventoryItem(LLUUID itemID)
1188 { 1188 {
1189 RemoveInventoryItemPacket remove = (RemoveInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.RemoveInventoryItem); 1189 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
1190 // TODO: don't create new blocks if recycling an old packet 1190 // TODO: don't create new blocks if recycling an old packet
1191 remove.AgentData.AgentID = AgentId; 1191 remove.AgentData.AgentID = AgentId;
1192 remove.AgentData.SessionID = m_sessionId; 1192 remove.AgentData.SessionID = m_sessionId;
@@ -1199,7 +1199,7 @@ namespace OpenSim.Region.ClientStack
1199 1199
1200 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) 1200 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
1201 { 1201 {
1202 ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket) PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory); 1202 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
1203 replytask.InventoryData.TaskID = taskID; 1203 replytask.InventoryData.TaskID = taskID;
1204 replytask.InventoryData.Serial = serial; 1204 replytask.InventoryData.Serial = serial;
1205 replytask.InventoryData.Filename = fileName; 1205 replytask.InventoryData.Filename = fileName;
@@ -1208,7 +1208,7 @@ namespace OpenSim.Region.ClientStack
1208 1208
1209 public void SendXferPacket(ulong xferID, uint packet, byte[] data) 1209 public void SendXferPacket(ulong xferID, uint packet, byte[] data)
1210 { 1210 {
1211 SendXferPacketPacket sendXfer = (SendXferPacketPacket) PacketPool.Instance.GetPacket(PacketType.SendXferPacket); 1211 SendXferPacketPacket sendXfer = new SendXferPacketPacket();
1212 sendXfer.XferID.ID = xferID; 1212 sendXfer.XferID.ID = xferID;
1213 sendXfer.XferID.Packet = packet; 1213 sendXfer.XferID.Packet = packet;
1214 sendXfer.DataPacket.Data = data; 1214 sendXfer.DataPacket.Data = data;
@@ -1226,7 +1226,7 @@ namespace OpenSim.Region.ClientStack
1226 /// <param name="message"></param> 1226 /// <param name="message"></param>
1227 public void SendAlertMessage(string message) 1227 public void SendAlertMessage(string message)
1228 { 1228 {
1229 AlertMessagePacket alertPack = (AlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AlertMessage); 1229 AlertMessagePacket alertPack = new AlertMessagePacket();
1230 alertPack.AlertData.Message = Helpers.StringToField(message); 1230 alertPack.AlertData.Message = Helpers.StringToField(message);
1231 OutPacket(alertPack, ThrottleOutPacketType.Task); 1231 OutPacket(alertPack, ThrottleOutPacketType.Task);
1232 } 1232 }
@@ -1238,7 +1238,7 @@ namespace OpenSim.Region.ClientStack
1238 /// <param name="modal"></param> 1238 /// <param name="modal"></param>
1239 public void SendAgentAlertMessage(string message, bool modal) 1239 public void SendAgentAlertMessage(string message, bool modal)
1240 { 1240 {
1241 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); 1241 AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket();
1242 alertPack.AgentData.AgentID = AgentId; 1242 alertPack.AgentData.AgentID = AgentId;
1243 alertPack.AlertData.Message = Helpers.StringToField(message); 1243 alertPack.AlertData.Message = Helpers.StringToField(message);
1244 alertPack.AlertData.Modal = modal; 1244 alertPack.AlertData.Modal = modal;
@@ -1248,7 +1248,7 @@ namespace OpenSim.Region.ClientStack
1248 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, 1248 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
1249 string url) 1249 string url)
1250 { 1250 {
1251 LoadURLPacket loadURL = (LoadURLPacket) PacketPool.Instance.GetPacket(PacketType.LoadURL); 1251 LoadURLPacket loadURL = new LoadURLPacket();
1252 loadURL.Data.ObjectName = Helpers.StringToField(objectname); 1252 loadURL.Data.ObjectName = Helpers.StringToField(objectname);
1253 loadURL.Data.ObjectID = objectID; 1253 loadURL.Data.ObjectID = objectID;
1254 loadURL.Data.OwnerID = ownerID; 1254 loadURL.Data.OwnerID = ownerID;
@@ -1274,7 +1274,7 @@ namespace OpenSim.Region.ClientStack
1274 1274
1275 public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) 1275 public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags)
1276 { 1276 {
1277 AttachedSoundPacket sound = (AttachedSoundPacket) PacketPool.Instance.GetPacket(PacketType.AttachedSound); 1277 AttachedSoundPacket sound = new AttachedSoundPacket();
1278 sound.DataBlock.SoundID = soundID; 1278 sound.DataBlock.SoundID = soundID;
1279 sound.DataBlock.ObjectID = objectID; 1279 sound.DataBlock.ObjectID = objectID;
1280 sound.DataBlock.OwnerID = ownerID; 1280 sound.DataBlock.OwnerID = ownerID;
@@ -1286,7 +1286,7 @@ namespace OpenSim.Region.ClientStack
1286 1286
1287 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) 1287 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
1288 { 1288 {
1289 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); 1289 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
1290 viewertime.TimeInfo.SunDirection = sunPos; 1290 viewertime.TimeInfo.SunDirection = sunPos;
1291 viewertime.TimeInfo.SunAngVelocity = sunVel; 1291 viewertime.TimeInfo.SunAngVelocity = sunVel;
1292 viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); 1292 viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch();
@@ -1296,7 +1296,7 @@ namespace OpenSim.Region.ClientStack
1296 public void SendViewerTime(int phase) 1296 public void SendViewerTime(int phase)
1297 { 1297 {
1298 Console.WriteLine("SunPhase: {0}", phase); 1298 Console.WriteLine("SunPhase: {0}", phase);
1299 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); 1299 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
1300 //viewertime.TimeInfo.SecPerDay = 86400; 1300 //viewertime.TimeInfo.SecPerDay = 86400;
1301 //viewertime.TimeInfo.SecPerYear = 31536000; 1301 //viewertime.TimeInfo.SecPerYear = 31536000;
1302 viewertime.TimeInfo.SecPerDay = 1000; 1302 viewertime.TimeInfo.SecPerDay = 1000;
@@ -1345,7 +1345,7 @@ namespace OpenSim.Region.ClientStack
1345 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, 1345 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
1346 LLUUID partnerID) 1346 LLUUID partnerID)
1347 { 1347 {
1348 AvatarPropertiesReplyPacket avatarReply = (AvatarPropertiesReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPropertiesReply); 1348 AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket();
1349 avatarReply.AgentData.AgentID = AgentId; 1349 avatarReply.AgentData.AgentID = AgentId;
1350 avatarReply.AgentData.AvatarID = avatarID; 1350 avatarReply.AgentData.AvatarID = avatarID;
1351 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); 1351 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
@@ -1370,7 +1370,7 @@ namespace OpenSim.Region.ClientStack
1370 /// <param name="wearables"></param> 1370 /// <param name="wearables"></param>
1371 public void SendWearables(AvatarWearable[] wearables, int serial) 1371 public void SendWearables(AvatarWearable[] wearables, int serial)
1372 { 1372 {
1373 AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket) PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate); 1373 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
1374 aw.AgentData.AgentID = AgentId; 1374 aw.AgentData.AgentID = AgentId;
1375 aw.AgentData.SerialNum = (uint) serial; 1375 aw.AgentData.SerialNum = (uint) serial;
1376 aw.AgentData.SessionID = m_sessionId; 1376 aw.AgentData.SessionID = m_sessionId;
@@ -1398,7 +1398,7 @@ namespace OpenSim.Region.ClientStack
1398 /// <param name="textureEntry"></param> 1398 /// <param name="textureEntry"></param>
1399 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) 1399 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
1400 { 1400 {
1401 AvatarAppearancePacket avp = (AvatarAppearancePacket) PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); 1401 AvatarAppearancePacket avp = new AvatarAppearancePacket();
1402 // TODO: don't create new blocks if recycling an old packet 1402 // TODO: don't create new blocks if recycling an old packet
1403 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 1403 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
1404 avp.ObjectData.TextureEntry = textureEntry; 1404 avp.ObjectData.TextureEntry = textureEntry;
@@ -1418,7 +1418,7 @@ namespace OpenSim.Region.ClientStack
1418 1418
1419 public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId) 1419 public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
1420 { 1420 {
1421 AvatarAnimationPacket ani = (AvatarAnimationPacket) PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); 1421 AvatarAnimationPacket ani = new AvatarAnimationPacket();
1422 // TODO: don't create new blocks if recycling an old packet 1422 // TODO: don't create new blocks if recycling an old packet
1423 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; 1423 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
1424 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); 1424 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
@@ -1453,7 +1453,7 @@ namespace OpenSim.Region.ClientStack
1453 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, 1453 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
1454 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) 1454 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
1455 { 1455 {
1456 ObjectUpdatePacket objupdate = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 1456 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
1457 // TODO: don't create new blocks if recycling an old packet 1457 // TODO: don't create new blocks if recycling an old packet
1458 objupdate.RegionData.RegionHandle = regionHandle; 1458 objupdate.RegionData.RegionHandle = regionHandle;
1459 objupdate.RegionData.TimeDilation = 64096; 1459 objupdate.RegionData.TimeDilation = 64096;
@@ -1486,7 +1486,7 @@ namespace OpenSim.Region.ClientStack
1486 { 1486 {
1487 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = 1487 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
1488 CreateAvatarImprovedBlock(localID, position, velocity, rotation); 1488 CreateAvatarImprovedBlock(localID, position, velocity, rotation);
1489 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 1489 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
1490 // TODO: don't create new blocks if recycling an old packet 1490 // TODO: don't create new blocks if recycling an old packet
1491 terse.RegionData.RegionHandle = regionHandle; 1491 terse.RegionData.RegionHandle = regionHandle;
1492 terse.RegionData.TimeDilation = timeDilation; 1492 terse.RegionData.TimeDilation = timeDilation;
@@ -1498,7 +1498,7 @@ namespace OpenSim.Region.ClientStack
1498 1498
1499 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) 1499 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations)
1500 { 1500 {
1501 CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket) PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); 1501 CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket();
1502 // TODO: don't create new blocks if recycling an old packet 1502 // TODO: don't create new blocks if recycling an old packet
1503 int total = CoarseLocations.Count; 1503 int total = CoarseLocations.Count;
1504 CoarseLocationUpdatePacket.IndexBlock ib = 1504 CoarseLocationUpdatePacket.IndexBlock ib =
@@ -1531,7 +1531,7 @@ namespace OpenSim.Region.ClientStack
1531 /// <param name="attachPoint"></param> 1531 /// <param name="attachPoint"></param>
1532 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) 1532 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
1533 { 1533 {
1534 ObjectAttachPacket attach = (ObjectAttachPacket) PacketPool.Instance.GetPacket(PacketType.ObjectAttach); 1534 ObjectAttachPacket attach = new ObjectAttachPacket();
1535 // TODO: don't create new blocks if recycling an old packet 1535 // TODO: don't create new blocks if recycling an old packet
1536 attach.AgentData.AgentID = AgentId; 1536 attach.AgentData.AgentID = AgentId;
1537 attach.AgentData.SessionID = m_sessionId; 1537 attach.AgentData.SessionID = m_sessionId;
@@ -1551,7 +1551,7 @@ namespace OpenSim.Region.ClientStack
1551 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, 1551 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
1552 LLQuaternion rotation, byte clickAction) 1552 LLQuaternion rotation, byte clickAction)
1553 { 1553 {
1554 ObjectUpdatePacket outPacket = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 1554 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
1555 // TODO: don't create new blocks if recycling an old packet 1555 // TODO: don't create new blocks if recycling an old packet
1556 outPacket.RegionData.RegionHandle = regionHandle; 1556 outPacket.RegionData.RegionHandle = regionHandle;
1557 outPacket.RegionData.TimeDilation = timeDilation; 1557 outPacket.RegionData.TimeDilation = timeDilation;
@@ -1595,7 +1595,7 @@ namespace OpenSim.Region.ClientStack
1595 { 1595 {
1596 LLVector3 velocity = new LLVector3(0f, 0f, 0f); 1596 LLVector3 velocity = new LLVector3(0f, 0f, 0f);
1597 LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f); 1597 LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f);
1598 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 1598 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
1599 // TODO: don't create new blocks if recycling an old packet 1599 // TODO: don't create new blocks if recycling an old packet
1600 terse.RegionData.RegionHandle = regionHandle; 1600 terse.RegionData.RegionHandle = regionHandle;
1601 terse.RegionData.TimeDilation = timeDilation; 1601 terse.RegionData.TimeDilation = timeDilation;
@@ -1608,7 +1608,7 @@ namespace OpenSim.Region.ClientStack
1608 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 1608 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
1609 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) 1609 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
1610 { 1610 {
1611 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 1611 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
1612 // TODO: don't create new blocks if recycling an old packet 1612 // TODO: don't create new blocks if recycling an old packet
1613 terse.RegionData.RegionHandle = regionHandle; 1613 terse.RegionData.RegionHandle = regionHandle;
1614 terse.RegionData.TimeDilation = timeDilation; 1614 terse.RegionData.TimeDilation = timeDilation;
@@ -1946,8 +1946,8 @@ namespace OpenSim.Region.ClientStack
1946 1946
1947 public void SendNameReply(LLUUID profileId, string firstname, string lastname) 1947 public void SendNameReply(LLUUID profileId, string firstname, string lastname)
1948 { 1948 {
1949 UUIDNameReplyPacket packet = (UUIDNameReplyPacket) PacketPool.Instance.GetPacket(PacketType.UUIDNameReply); 1949 UUIDNameReplyPacket packet = new UUIDNameReplyPacket();
1950 // TODO: don't create new blocks if recycling an old packet 1950
1951 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; 1951 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
1952 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); 1952 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
1953 packet.UUIDNameBlock[0].ID = profileId; 1953 packet.UUIDNameBlock[0].ID = profileId;
@@ -1995,7 +1995,7 @@ namespace OpenSim.Region.ClientStack
1995 { 1995 {
1996 //System.Console.WriteLine("texture cached: " + packet.ToString()); 1996 //System.Console.WriteLine("texture cached: " + packet.ToString());
1997 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet; 1997 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet;
1998 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket) PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 1998 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
1999 // TODO: don't create new blocks if recycling an old packet 1999 // TODO: don't create new blocks if recycling an old packet
2000 cachedresp.AgentData.AgentID = AgentId; 2000 cachedresp.AgentData.AgentID = AgentId;
2001 cachedresp.AgentData.SessionID = m_sessionId; 2001 cachedresp.AgentData.SessionID = m_sessionId;
@@ -2156,7 +2156,7 @@ namespace OpenSim.Region.ClientStack
2156 { 2156 {
2157 //should be getting the map layer from the grid server 2157 //should be getting the map layer from the grid server
2158 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) 2158 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
2159 MapLayerReplyPacket mapReply = (MapLayerReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapLayerReply); 2159 MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
2160 // TODO: don't create new blocks if recycling an old packet 2160 // TODO: don't create new blocks if recycling an old packet
2161 mapReply.AgentData.AgentID = AgentId; 2161 mapReply.AgentData.AgentID = AgentId;
2162 mapReply.AgentData.Flags = 0; 2162 mapReply.AgentData.Flags = 0;
@@ -2301,18 +2301,22 @@ namespace OpenSim.Region.ClientStack
2301 // Actually make the byte array and send it 2301 // Actually make the byte array and send it
2302 try 2302 try
2303 { 2303 {
2304 byte[] sendbuffer = Pack.ToBytes(); 2304 byte[] sendbuffer = Pack.ToBytes();
2305 PacketPool.Instance.ReturnPacket(Pack); 2305 if (Pack is RegionHandshakePacket)
2306 2306 {
2307 if (Pack.Header.Zerocoded) 2307 PacketPool.Instance.ReturnPacket(Pack);
2308 { 2308 }
2309 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 2309
2310 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); 2310 if (Pack.Header.Zerocoded)
2311 } 2311 {
2312 else 2312 byte[] ZeroOutBuffer = new byte[4096];
2313 { 2313 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
2314 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); 2314 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
2315 } 2315 }
2316 else
2317 {
2318 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
2319 }
2316 } 2320 }
2317 catch (Exception e) 2321 catch (Exception e)
2318 { 2322 {
@@ -2358,7 +2362,7 @@ namespace OpenSim.Region.ClientStack
2358 { 2362 {
2359 //reply to pingcheck 2363 //reply to pingcheck
2360 StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; 2364 StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack;
2361 CompletePingCheckPacket endPing = (CompletePingCheckPacket) PacketPool.Instance.GetPacket(PacketType.CompletePingCheck); 2365 CompletePingCheckPacket endPing = new CompletePingCheckPacket();
2362 endPing.PingID.PingID = startPing.PingID.PingID; 2366 endPing.PingID.PingID = startPing.PingID.PingID;
2363 OutPacket(endPing, ThrottleOutPacketType.Task); 2367 OutPacket(endPing, ThrottleOutPacketType.Task);
2364 } 2368 }
@@ -2387,7 +2391,7 @@ namespace OpenSim.Region.ClientStack
2387 { 2391 {
2388 if (Pack.Header.Reliable) 2392 if (Pack.Header.Reliable)
2389 { 2393 {
2390 PacketAckPacket ack_it = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck); 2394 PacketAckPacket ack_it = new PacketAckPacket();
2391 // TODO: don't create new blocks if recycling an old packet 2395 // TODO: don't create new blocks if recycling an old packet
2392 ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; 2396 ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
2393 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); 2397 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
@@ -2443,7 +2447,7 @@ namespace OpenSim.Region.ClientStack
2443 //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck"); 2447 //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck");
2444 2448
2445 int i = 0; 2449 int i = 0;
2446 PacketAckPacket acks = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck); 2450 PacketAckPacket acks = new PacketAckPacket();
2447 // TODO: don't create new blocks if recycling an old packet 2451 // TODO: don't create new blocks if recycling an old packet
2448 acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count]; 2452 acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count];
2449 2453
@@ -2540,14 +2544,6 @@ namespace OpenSim.Region.ClientStack
2540 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack; 2544 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack;
2541 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 2545 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
2542 string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message); 2546 string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message);
2543 //byte[] msgpack.MessageBlock.BinaryBucket;
2544 //bool msgpack.MessageBlock.FromGroup;
2545
2546 //byte msgpack.MessageBlock.Offline;
2547 //uint msgpack.MessageBlock.ParentEstateID;
2548 //LLVector3 msgpack.MessageBlock.Position;
2549 //LLUUID msgpack.MessageBlock.RegionID;
2550
2551 if (OnInstantMessage != null) 2547 if (OnInstantMessage != null)
2552 { 2548 {
2553 OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, 2549 OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
@@ -2555,7 +2551,7 @@ namespace OpenSim.Region.ClientStack
2555 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, 2551 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
2556 msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup, 2552 msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup,
2557 msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID, 2553 msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID,
2558 msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID, 2554 msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
2559 msgpack.MessageBlock.BinaryBucket); 2555 msgpack.MessageBlock.BinaryBucket);
2560 } 2556 }
2561 break; 2557 break;
@@ -2571,19 +2567,14 @@ namespace OpenSim.Region.ClientStack
2571 //rezPacket.RezData.RemoveItem; 2567 //rezPacket.RezData.RemoveItem;
2572 //rezPacket.RezData.RezSelected; 2568 //rezPacket.RezData.RezSelected;
2573 //rezPacket.RezData.FromTaskID; 2569 //rezPacket.RezData.FromTaskID;
2574 //rezPacket.RezData.FromTaskID;
2575 //rezPacket.RezData.EveryoneMask;
2576 //rezPacket.RezData.GroupMask;
2577 //rezPacket.RezData.NextOwnerMask;
2578
2579 //MainLog.Instance.Verbose("REZData", rezPacket.ToString()); 2570 //MainLog.Instance.Verbose("REZData", rezPacket.ToString());
2580 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, 2571 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
2581 rezPacket.RezData.RayStart,rezPacket.RezData.RayTargetID, 2572 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
2582 rezPacket.RezData.BypassRaycast,rezPacket.RezData.RayEndIsIntersection, 2573 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
2583 rezPacket.RezData.EveryoneMask,rezPacket.RezData.GroupMask, 2574 rezPacket.RezData.EveryoneMask, rezPacket.RezData.GroupMask,
2584 rezPacket.RezData.NextOwnerMask,rezPacket.RezData.ItemFlags, 2575 rezPacket.RezData.NextOwnerMask, rezPacket.RezData.ItemFlags,
2585 rezPacket.RezData.RezSelected,rezPacket.RezData.RemoveItem, 2576 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
2586 rezPacket.RezData.FromTaskID); 2577 rezPacket.RezData.FromTaskID);
2587 } 2578 }
2588 break; 2579 break;
2589 case PacketType.DeRezObject: 2580 case PacketType.DeRezObject:
@@ -2762,6 +2753,12 @@ namespace OpenSim.Region.ClientStack
2762 { 2753 {
2763 ObjectAddPacket addPacket = (ObjectAddPacket) Pack; 2754 ObjectAddPacket addPacket = (ObjectAddPacket) Pack;
2764 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); 2755 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
2756 MainLog.Instance.Verbose("REZData", addPacket.ToString());
2757 //BypassRaycast: 1
2758 //RayStart: <69.79469, 158.2652, 98.40343>
2759 //RayEnd: <61.97724, 141.995, 92.58341>
2760 //RayTargetID: 00000000-0000-0000-0000-000000000000
2761
2765 OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape,addPacket.ObjectData.BypassRaycast,addPacket.ObjectData.RayStart,addPacket.ObjectData.RayTargetID,addPacket.ObjectData.RayEndIsIntersection); 2762 OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape,addPacket.ObjectData.BypassRaycast,addPacket.ObjectData.RayStart,addPacket.ObjectData.RayTargetID,addPacket.ObjectData.RayEndIsIntersection);
2766 } 2763 }
2767 break; 2764 break;
@@ -2884,9 +2881,10 @@ namespace OpenSim.Region.ClientStack
2884 break; 2881 break;
2885 case PacketType.ObjectPermissions: 2882 case PacketType.ObjectPermissions:
2886 MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString()); 2883 MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString());
2887 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; 2884 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket) Pack;
2888 2885
2889 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges = new List<ObjectPermissionsPacket.ObjectDataBlock>(); 2886 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges =
2887 new List<ObjectPermissionsPacket.ObjectDataBlock>();
2890 2888
2891 for (int i = 0; i < newobjPerms.ObjectData.Length; i++) 2889 for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
2892 { 2890 {
@@ -2916,7 +2914,7 @@ namespace OpenSim.Region.ClientStack
2916 2914
2917 case PacketType.RequestObjectPropertiesFamily: 2915 case PacketType.RequestObjectPropertiesFamily:
2918 //This powers the little tooltip that appears when you move your mouse over an object 2916 //This powers the little tooltip that appears when you move your mouse over an object
2919 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; 2917 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket) Pack;
2920 2918
2921 2919
2922 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; 2920 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
@@ -3020,7 +3018,7 @@ namespace OpenSim.Region.ClientStack
3020 case PacketType.MoveInventoryFolder: 3018 case PacketType.MoveInventoryFolder:
3021 if (OnMoveInventoryFolder != null) 3019 if (OnMoveInventoryFolder != null)
3022 { 3020 {
3023 MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack; 3021 MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket) Pack;
3024 for (int i = 0; i < invFolder.InventoryData.Length; i++) 3022 for (int i = 0; i < invFolder.InventoryData.Length; i++)
3025 { 3023 {
3026 OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID, 3024 OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID,
@@ -3127,7 +3125,7 @@ namespace OpenSim.Region.ClientStack
3127 } 3125 }
3128 break; 3126 break;
3129 case PacketType.MoveInventoryItem: 3127 case PacketType.MoveInventoryItem:
3130 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack; 3128 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket) Pack;
3131 if (OnMoveInventoryItem != null) 3129 if (OnMoveInventoryItem != null)
3132 { 3130 {
3133 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 3131 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
@@ -3196,11 +3194,11 @@ namespace OpenSim.Region.ClientStack
3196 case PacketType.TeleportLandmarkRequest: 3194 case PacketType.TeleportLandmarkRequest:
3197 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack; 3195 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack;
3198 3196
3199 TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart); 3197 TeleportStartPacket tpStart = new TeleportStartPacket();
3200 tpStart.Info.TeleportFlags = 8; // tp via lm 3198 tpStart.Info.TeleportFlags = 8; // tp via lm
3201 OutPacket(tpStart, ThrottleOutPacketType.Task); 3199 OutPacket(tpStart, ThrottleOutPacketType.Task);
3202 3200
3203 TeleportProgressPacket tpProgress = (TeleportProgressPacket) PacketPool.Instance.GetPacket(PacketType.TeleportProgress); 3201 TeleportProgressPacket tpProgress = new TeleportProgressPacket();
3204 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); 3202 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
3205 tpProgress.Info.TeleportFlags = 8; 3203 tpProgress.Info.TeleportFlags = 8;
3206 tpProgress.AgentData.AgentID = tpReq.Info.AgentID; 3204 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
@@ -3215,7 +3213,7 @@ namespace OpenSim.Region.ClientStack
3215 3213
3216 if (lm.RegionID == m_scene.RegionInfo.RegionID) 3214 if (lm.RegionID == m_scene.RegionInfo.RegionID)
3217 { 3215 {
3218 TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal); 3216 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
3219 3217
3220 tpLocal.Info.AgentID = tpReq.Info.AgentID; 3218 tpLocal.Info.AgentID = tpReq.Info.AgentID;
3221 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark 3219 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
@@ -3225,7 +3223,7 @@ namespace OpenSim.Region.ClientStack
3225 } 3223 }
3226 else 3224 else
3227 { 3225 {
3228 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 3226 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
3229 tpCancel.Info.AgentID = tpReq.Info.AgentID; 3227 tpCancel.Info.AgentID = tpReq.Info.AgentID;
3230 tpCancel.Info.SessionID = tpReq.Info.SessionID; 3228 tpCancel.Info.SessionID = tpReq.Info.SessionID;
3231 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3229 OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3235,7 +3233,7 @@ namespace OpenSim.Region.ClientStack
3235 { 3233 {
3236 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); 3234 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
3237 3235
3238 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 3236 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
3239 tpCancel.Info.AgentID = tpReq.Info.AgentID; 3237 tpCancel.Info.AgentID = tpReq.Info.AgentID;
3240 tpCancel.Info.SessionID = tpReq.Info.SessionID; 3238 tpCancel.Info.SessionID = tpReq.Info.SessionID;
3241 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3239 OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3253,7 +3251,7 @@ namespace OpenSim.Region.ClientStack
3253 else 3251 else
3254 { 3252 {
3255 //no event handler so cancel request 3253 //no event handler so cancel request
3256 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 3254 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
3257 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 3255 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
3258 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; 3256 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
3259 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3257 OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3561,7 +3559,7 @@ namespace OpenSim.Region.ClientStack
3561 3559
3562 public void SendLogoutPacket() 3560 public void SendLogoutPacket()
3563 { 3561 {
3564 LogoutReplyPacket logReply = (LogoutReplyPacket) PacketPool.Instance.GetPacket(PacketType.LogoutReply); 3562 LogoutReplyPacket logReply = new LogoutReplyPacket();
3565 // TODO: don't create new blocks if recycling an old packet 3563 // TODO: don't create new blocks if recycling an old packet
3566 logReply.AgentData.AgentID = AgentId; 3564 logReply.AgentData.AgentID = AgentId;
3567 logReply.AgentData.SessionID = SessionId; 3565 logReply.AgentData.SessionID = SessionId;
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 5c99ffd..bd26fdf 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Environment.LandManagement
111 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, 111 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
112 IClientAPI remote_client) 112 IClientAPI remote_client)
113 { 113 {
114 ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); 114 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
115 // TODO: don't create new blocks if recycling an old packet 115 // TODO: don't create new blocks if recycling an old packet
116 116
117 updatePacket.ParcelData.AABBMax = landData.AABBMax; 117 updatePacket.ParcelData.AABBMax = landData.AABBMax;
@@ -337,7 +337,7 @@ namespace OpenSim.Region.Environment.LandManagement
337 337
338 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) 338 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both)
339 { 339 {
340 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); 340 replyPacket = new ParcelAccessListReplyPacket();
341 replyPacket.Data.AgentID = agentID; 341 replyPacket.Data.AgentID = agentID;
342 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; 342 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access;
343 replyPacket.Data.LocalID = landData.localID; 343 replyPacket.Data.LocalID = landData.localID;
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Environment.LandManagement
349 349
350 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) 350 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
351 { 351 {
352 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); 352 replyPacket = new ParcelAccessListReplyPacket();
353 replyPacket.Data.AgentID = agentID; 353 replyPacket.Data.AgentID = agentID;
354 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; 354 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban;
355 replyPacket.Data.LocalID = landData.localID; 355 replyPacket.Data.LocalID = landData.localID;
@@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.LandManagement
660 660
661 bool firstCall = true; 661 bool firstCall = true;
662 int MAX_OBJECTS_PER_PACKET = 251; 662 int MAX_OBJECTS_PER_PACKET = 251;
663 ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); 663 ForceObjectSelectPacket pack = new ForceObjectSelectPacket();
664 // TODO: don't create new blocks if recycling an old packet 664 // TODO: don't create new blocks if recycling an old packet
665 ForceObjectSelectPacket.DataBlock[] data; 665 ForceObjectSelectPacket.DataBlock[] data;
666 while (resultLocalIDs.Count > 0) 666 while (resultLocalIDs.Count > 0)
@@ -699,7 +699,7 @@ namespace OpenSim.Region.Environment.LandManagement
699 public void sendLandObjectOwners(IClientAPI remote_client) 699 public void sendLandObjectOwners(IClientAPI remote_client)
700 { 700 {
701 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); 701 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>();
702 ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); 702 ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket();
703 // TODO: don't create new blocks if recycling an old packet 703 // TODO: don't create new blocks if recycling an old packet
704 704
705 foreach (SceneObjectGroup obj in primsOverMe) 705 foreach (SceneObjectGroup obj in primsOverMe)
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 22e7fc9..d463964 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -494,7 +494,7 @@ namespace OpenSim.Region.Environment.LandManagement
494 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) 494 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
495 { 495 {
496 byteArrayCount = 0; 496 byteArrayCount = 0;
497 packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); 497 packet = new ParcelOverlayPacket();
498 packet.ParcelData.Data = byteArray; 498 packet.ParcelData.Data = byteArray;
499 packet.ParcelData.SequenceID = sequenceID; 499 packet.ParcelData.SequenceID = sequenceID;
500 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); 500 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 1a77565..5b46040 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -557,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes
557 557
558 if (rezAsset != null) 558 if (rezAsset != null)
559 { 559 {
560 string script = Util.FieldToString(rezAsset.Data); 560 string script = Helpers.FieldToUTF8String(rezAsset.Data);
561 EventManager.TriggerRezScript(localID, copyID, script); 561 EventManager.TriggerRezScript(localID, copyID, script);
562 rezzed = true; 562 rezzed = true;
563 } 563 }
@@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes
733 733
734 if (rezAsset != null) 734 if (rezAsset != null)
735 { 735 {
736 AddRezObject(Util.FieldToString(rezAsset.Data), pos); 736 AddRezObject(Helpers.FieldToUTF8String(rezAsset.Data), pos);
737 //userInfo.DeleteItem(remoteClient.AgentId, item); 737 //userInfo.DeleteItem(remoteClient.AgentId, item);
738 //remoteClient.SendRemoveInventoryItem(itemID); 738 //remoteClient.SendRemoveInventoryItem(itemID);
739 } 739 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 647fbf4..af4573b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
166 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); 166 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>();
167 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); 167 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query);
168 168
169 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); 169 AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket();
170 // TODO: don't create new blocks if recycling an old packet 170 // TODO: don't create new blocks if recycling an old packet
171 171
172 AvatarPickerReplyPacket.DataBlock[] searchData = 172 AvatarPickerReplyPacket.DataBlock[] searchData =
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 89b68de..d710e49 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -931,7 +931,6 @@ namespace OpenSim.Region.Environment.Scenes
931 if (RayEndIsIntersection == (byte)1) 931 if (RayEndIsIntersection == (byte)1)
932 { 932 {
933 pos = RayEnd; 933 pos = RayEnd;
934 pos.Z += 0.25F;
935 return pos; 934 return pos;
936 } 935 }
937 if (RayTargetID != LLUUID.Zero) 936 if (RayTargetID != LLUUID.Zero)
@@ -987,14 +986,13 @@ namespace OpenSim.Region.Environment.Scenes
987 986
988 987
989 988
990 pos.Z += 0.25F; 989
991 return pos; 990 return pos;
992 } 991 }
993 else 992 else
994 { 993 {
995 // fall back to our stupid functionality 994 // fall back to our stupid functionality
996 pos = RayEnd; 995 pos = RayEnd;
997 pos.Z += 0.25F;
998 return pos; 996 return pos;
999 } 997 }
1000 } 998 }
@@ -1002,7 +1000,6 @@ namespace OpenSim.Region.Environment.Scenes
1002 { 1000 {
1003 // fall back to our stupid functionality 1001 // fall back to our stupid functionality
1004 pos = RayEnd; 1002 pos = RayEnd;
1005 pos.Z += 0.25F;
1006 return pos; 1003 return pos;
1007 } 1004 }
1008 1005
@@ -1012,7 +1009,12 @@ namespace OpenSim.Region.Environment.Scenes
1012 byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, 1009 byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID,
1013 byte RayEndIsIntersection) 1010 byte RayEndIsIntersection)
1014 { 1011 {
1015 1012 // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision
1013 // in the direction the client supplies (the ground level that we clicked)
1014 // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go
1015 // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did.
1016 // It's wrong many times though.
1017
1016 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); 1018 LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection);
1017 1019
1018 1020
@@ -1020,40 +1022,36 @@ namespace OpenSim.Region.Environment.Scenes
1020 1022
1021 if (PermissionsMngr.CanRezObject(ownerID, pos)) 1023 if (PermissionsMngr.CanRezObject(ownerID, pos))
1022 { 1024 {
1023 // rez ON the ground, not IN the ground
1024
1025
1026 1025
1027 AddNewPrim(ownerID, pos, rot, shape); 1026 // rez ON the ground, not IN the ground
1028 } 1027 pos.Z += 0.25F;
1029 } 1028
1030 1029
1031 public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) 1030 SceneObjectGroup sceneOb =
1032 { 1031 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape);
1033 SceneObjectGroup sceneOb = 1032 AddEntity(sceneOb);
1034 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); 1033 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
1035 AddEntity(sceneOb); 1034 // if grass or tree, make phantom
1036 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); 1035 //rootPart.ApplySanePermissions();
1037 // if grass or tree, make phantom 1036 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111))
1038 //rootPart.ApplySanePermissions(); 1037 {
1039 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) 1038 rootPart.AddFlag(LLObject.ObjectFlags.Phantom);
1040 { 1039 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
1041 rootPart.AddFlag(LLObject.ObjectFlags.Phantom); 1040 }
1042 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 1041 // if not phantom, add to physics
1043 } 1042 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
1044 // if not phantom, add to physics 1043 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
1045 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 1044 {
1046 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 1045 rootPart.PhysActor =
1047 { 1046 PhysicsScene.AddPrimShape(
1048 rootPart.PhysActor = 1047 rootPart.Name,
1049 PhysicsScene.AddPrimShape( 1048 rootPart.Shape,
1050 rootPart.Name, 1049 new PhysicsVector(pos.X, pos.Y, pos.Z),
1051 rootPart.Shape, 1050 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
1052 new PhysicsVector(pos.X, pos.Y, pos.Z), 1051 new Quaternion(), UsePhysics);
1053 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 1052 // subscribe to physics events.
1054 new Quaternion(), UsePhysics); 1053 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
1055 // subscribe to physics events. 1054 }
1056 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
1057 } 1055 }
1058 } 1056 }
1059 1057
@@ -1500,7 +1498,7 @@ namespace OpenSim.Region.Environment.Scenes
1500 m_innerScene.removeUserCount(true); 1498 m_innerScene.removeUserCount(true);
1501 } 1499 }
1502 // Tell a single agent to disconnect from the region. 1500 // Tell a single agent to disconnect from the region.
1503 libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); 1501 DisableSimulatorPacket disable = new DisableSimulatorPacket();
1504 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); 1502 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task);
1505 } 1503 }
1506 } 1504 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 0f8ce0b..3fc7aec 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes
636 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) 636 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags)
637 { 637 {
638 //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); 638 //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
639 ObjectPropertiesFamilyPacket objPropFamilyPack = (ObjectPropertiesFamilyPacket) PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); 639 ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket();
640 // TODO: don't create new blocks if recycling an old packet 640 // TODO: don't create new blocks if recycling an old packet
641 641
642 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); 642 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock();
@@ -677,32 +677,26 @@ namespace OpenSim.Region.Environment.Scenes
677 /// </summary> 677 /// </summary>
678 public override void Update() 678 public override void Update()
679 { 679 {
680 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_parts.Values);
681
682 if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) 680 if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
683 { 681 {
684 foreach (SceneObjectPart part in parts) 682 foreach (SceneObjectPart part in m_parts.Values)
685 { 683 {
686 if (part.UpdateFlag == 0) part.UpdateFlag = 1; 684 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
687 } 685 }
688
689 lastPhysGroupPos = AbsolutePosition; 686 lastPhysGroupPos = AbsolutePosition;
690 } 687 }
691
692 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) 688 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
693 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) 689 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
694 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) 690 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
695 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) 691 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
696 { 692 {
697 foreach (SceneObjectPart part in parts) 693 foreach (SceneObjectPart part in m_parts.Values)
698 { 694 {
699 if (part.UpdateFlag == 0) part.UpdateFlag = 1; 695 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
700 } 696 }
701
702 lastPhysGroupRot = GroupRotation; 697 lastPhysGroupRot = GroupRotation;
703 } 698 }
704 699 foreach (SceneObjectPart part in m_parts.Values)
705 foreach (SceneObjectPart part in parts)
706 { 700 {
707 part.SendScheduledUpdates(); 701 part.SendScheduledUpdates();
708 } 702 }
@@ -1051,7 +1045,7 @@ namespace OpenSim.Region.Environment.Scenes
1051 /// <param name="client"></param> 1045 /// <param name="client"></param>
1052 public void GetProperites(IClientAPI client) 1046 public void GetProperites(IClientAPI client)
1053 { 1047 {
1054 ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 1048 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
1055 // TODO: don't create new blocks if recycling an old packet 1049 // TODO: don't create new blocks if recycling an old packet
1056 1050
1057 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 1051 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
@@ -1086,6 +1080,7 @@ namespace OpenSim.Region.Environment.Scenes
1086 /// <param name="name"></param> 1080 /// <param name="name"></param>
1087 public void SetPartName(string name, uint localID) 1081 public void SetPartName(string name, uint localID)
1088 { 1082 {
1083 name = name.Remove(name.Length - 1, 1);
1089 SceneObjectPart part = GetChildPart(localID); 1084 SceneObjectPart part = GetChildPart(localID);
1090 if (part != null) 1085 if (part != null)
1091 { 1086 {
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index 5033965..d955fe7 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes
83 private void statsHeartBeat(object sender, EventArgs e) 83 private void statsHeartBeat(object sender, EventArgs e)
84 { 84 {
85 m_report.Enabled = false; 85 m_report.Enabled = false;
86 SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats); 86 SimStatsPacket statpack = new SimStatsPacket();
87 // TODO: don't create new blocks if recycling an old packet 87 // TODO: don't create new blocks if recycling an old packet
88 88
89 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; 89 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11];
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index a118e7c..335c3fc 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -404,18 +404,18 @@ namespace OpenSim.Region.Physics.OdePlugin
404 // ok -- let's stand up straight! 404 // ok -- let's stand up straight!
405 //d.Matrix3 StandUpRotationalMatrix = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f); 405 //d.Matrix3 StandUpRotationalMatrix = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f);
406 //d.BodySetRotation(Body, ref StandUpRotationalMatrix); 406 //d.BodySetRotation(Body, ref StandUpRotationalMatrix);
407 d.BodySetRotation(Body, ref m_StandUpRotation); 407 //d.BodySetRotation(Body, ref m_StandUpRotation);
408 // The above matrix was generated with the amazing standup routine below by danX0r *cheer* 408 // The above matrix was generated with the amazing standup routine below by danX0r *cheer*
409 //d.Vector3 feet; 409 d.Vector3 feet;
410 //d.Vector3 head; 410 d.Vector3 head;
411 //d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet); 411 d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet);
412 //d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head); 412 d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head);
413 //float posture = head.Z - feet.Z; 413 float posture = head.Z - feet.Z;
414 414
415 // restoring force proportional to lack of posture: 415 // restoring force proportional to lack of posture:
416 //float servo = (2.5f - posture) * POSTURE_SERVO; 416 float servo = (2.5f - posture) * POSTURE_SERVO;
417 //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); 417 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
418 //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); 418 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
419 419
420 //m_lastUpdateSent = false; 420 //m_lastUpdateSent = false;
421 } 421 }
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 006d829..f8ab8e7 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -300,11 +300,11 @@ namespace OpenSim.Region.Physics.OdePlugin
300 { 300 {
301 if (p2.PhysicsActorType == (int) ActorTypes.Agent) 301 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
302 { 302 {
303 p2.CollidingObj = true; 303 //p2.CollidingObj = true;
304 //contacts[i].depth = 0.003f; 304 //contacts[i].depth = 0.003f;
305 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); 305 //p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
306 OdeCharacter character = (OdeCharacter) p2; 306 //OdeCharacter character = (OdeCharacter) p2;
307 character.SetPidStatus(true); 307 //character.SetPidStatus(true);
308 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); 308 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2));
309 309
310 } 310 }
@@ -316,12 +316,12 @@ namespace OpenSim.Region.Physics.OdePlugin
316 if (p1.PhysicsActorType == (int) ActorTypes.Agent) 316 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
317 { 317 {
318 318
319 p1.CollidingObj = true; 319 //p1.CollidingObj = true;
320 //contacts[i].depth = 0.003f; 320 //contacts[i].depth = 0.003f;
321 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); 321 //p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
322 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2)); 322 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2));
323 OdeCharacter character = (OdeCharacter)p1; 323 //OdeCharacter character = (OdeCharacter)p1;
324 character.SetPidStatus(true); 324 //character.SetPidStatus(true);
325 } 325 }
326 else 326 else
327 { 327 {
diff --git a/bin/libsecondlife.dll b/bin/libsecondlife.dll
index 1427824..6c20c19 100644
--- a/bin/libsecondlife.dll
+++ b/bin/libsecondlife.dll
Binary files differ