aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs144
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs952
-rw-r--r--OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs516
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs158
4 files changed, 885 insertions, 885 deletions
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index b53c05e..440d948 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -1,72 +1,72 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework.Interfaces; 29using OpenSim.Framework.Interfaces;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using Nini.Config; 32using Nini.Config;
33 33
34namespace OpenSim.Region.Environment.Modules 34namespace OpenSim.Region.Environment.Modules
35{ 35{
36 public class AssetDownloadModule : IRegionModule 36 public class AssetDownloadModule : IRegionModule
37 { 37 {
38 private Scene m_scene; 38 private Scene m_scene;
39 39
40 public AssetDownloadModule() 40 public AssetDownloadModule()
41 { 41 {
42 } 42 }
43 43
44 public void Initialise(Scene scene, IConfigSource config) 44 public void Initialise(Scene scene, IConfigSource config)
45 { 45 {
46 m_scene = scene; 46 m_scene = scene;
47 m_scene.EventManager.OnNewClient += NewClient; 47 m_scene.EventManager.OnNewClient += NewClient;
48 } 48 }
49 49
50 public void PostInitialise() 50 public void PostInitialise()
51 { 51 {
52 } 52 }
53 53
54 public void Close() 54 public void Close()
55 { 55 {
56 } 56 }
57 57
58 public string Name 58 public string Name
59 { 59 {
60 get { return "AssetDownloadModule"; } 60 get { return "AssetDownloadModule"; }
61 } 61 }
62 62
63 public bool IsSharedModule 63 public bool IsSharedModule
64 { 64 {
65 get { return false; } 65 get { return false; }
66 } 66 }
67 67
68 public void NewClient(IClientAPI client) 68 public void NewClient(IClientAPI client)
69 { 69 {
70 } 70 }
71 } 71 }
72} 72}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index ff58fd8..96beb05 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1,476 +1,476 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using Axiom.Math; 29using Axiom.Math;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
33using OpenSim.Framework.Communications.Caches; 33using OpenSim.Framework.Communications.Caches;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.Physics.Manager;
38 38
39namespace OpenSim.Region.Environment.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public partial class Scene 41 public partial class Scene
42 { 42 {
43 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete 43 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
44 // or at least some of they can be moved somewhere else 44 // or at least some of they can be moved somewhere else
45 45
46 public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) 46 public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item)
47 { 47 {
48 ScenePresence avatar; 48 ScenePresence avatar;
49 49
50 if ( TryGetAvatar( avatarId, out avatar )) 50 if ( TryGetAvatar( avatarId, out avatar ))
51 { 51 {
52 AddInventoryItem(avatar.ControllingClient, item); 52 AddInventoryItem(avatar.ControllingClient, item);
53 } 53 }
54 } 54 }
55 55
56 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 56 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
57 { 57 {
58 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 58 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
59 if (userInfo != null) 59 if (userInfo != null)
60 { 60 {
61 userInfo.AddItem(remoteClient.AgentId, item); 61 userInfo.AddItem(remoteClient.AgentId, item);
62 remoteClient.SendInventoryItemUpdate(item); 62 remoteClient.SendInventoryItemUpdate(item);
63 } 63 }
64 } 64 }
65 65
66 public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) 66 public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data)
67 { 67 {
68 ScenePresence avatar; 68 ScenePresence avatar;
69 69
70 if (TryGetAvatar(avatarId, out avatar)) 70 if (TryGetAvatar(avatarId, out avatar))
71 { 71 {
72 return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); 72 return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
73 } 73 }
74 74
75 return LLUUID.Zero; 75 return LLUUID.Zero;
76 } 76 }
77 77
78 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) 78 public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
79 { 79 {
80 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 80 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
81 if (userInfo != null) 81 if (userInfo != null)
82 { 82 {
83 if (userInfo.RootFolder != null) 83 if (userInfo.RootFolder != null)
84 { 84 {
85 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 85 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
86 if (item != null) 86 if (item != null)
87 { 87 {
88 AssetBase asset; 88 AssetBase asset;
89 asset = new AssetBase(); 89 asset = new AssetBase();
90 asset.FullID = LLUUID.Random(); 90 asset.FullID = LLUUID.Random();
91 asset.Type = (sbyte) item.assetType; 91 asset.Type = (sbyte) item.assetType;
92 asset.InvType = (sbyte) item.invType; 92 asset.InvType = (sbyte) item.invType;
93 asset.Name = item.inventoryName; 93 asset.Name = item.inventoryName;
94 asset.Data = data; 94 asset.Data = data;
95 commsManager.AssetCache.AddAsset(asset); 95 commsManager.AssetCache.AddAsset(asset);
96 96
97 item.assetID = asset.FullID; 97 item.assetID = asset.FullID;
98 userInfo.UpdateItem(remoteClient.AgentId, item); 98 userInfo.UpdateItem(remoteClient.AgentId, item);
99 99
100 // remoteClient.SendInventoryItemUpdate(item); 100 // remoteClient.SendInventoryItemUpdate(item);
101 if (item.invType == 7) 101 if (item.invType == 7)
102 { 102 {
103 //do we want to know about updated note cards? 103 //do we want to know about updated note cards?
104 } 104 }
105 else if (item.invType == 10) 105 else if (item.invType == 10)
106 { 106 {
107 // do we want to know about updated scripts 107 // do we want to know about updated scripts
108 } 108 }
109 109
110 return (asset.FullID); 110 return (asset.FullID);
111 } 111 }
112 } 112 }
113 } 113 }
114 return LLUUID.Zero; 114 return LLUUID.Zero;
115 } 115 }
116 116
117 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, 117 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
118 LLUUID itemID) 118 LLUUID itemID)
119 { 119 {
120 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 120 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
121 if (userInfo != null) 121 if (userInfo != null)
122 { 122 {
123 if (userInfo.RootFolder != null) 123 if (userInfo.RootFolder != null)
124 { 124 {
125 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 125 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
126 if (item != null) 126 if (item != null)
127 { 127 {
128 AgentAssetTransactions transactions = 128 AgentAssetTransactions transactions =
129 commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 129 commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
130 if (transactions != null) 130 if (transactions != null)
131 { 131 {
132 AssetBase asset = null; 132 AssetBase asset = null;
133 bool addToCache = false; 133 bool addToCache = false;
134 134
135 asset = commsManager.AssetCache.GetAsset(assetID); 135 asset = commsManager.AssetCache.GetAsset(assetID);
136 if (asset == null) 136 if (asset == null)
137 { 137 {
138 asset = transactions.GetTransactionAsset(transactionID); 138 asset = transactions.GetTransactionAsset(transactionID);
139 addToCache = true; 139 addToCache = true;
140 } 140 }
141 141
142 if (asset != null) 142 if (asset != null)
143 { 143 {
144 if (asset.FullID == assetID) 144 if (asset.FullID == assetID)
145 { 145 {
146 asset.Name = item.inventoryName; 146 asset.Name = item.inventoryName;
147 asset.Description = item.inventoryDescription; 147 asset.Description = item.inventoryDescription;
148 asset.InvType = (sbyte) item.invType; 148 asset.InvType = (sbyte) item.invType;
149 asset.Type = (sbyte) item.assetType; 149 asset.Type = (sbyte) item.assetType;
150 item.assetID = asset.FullID; 150 item.assetID = asset.FullID;
151 151
152 if (addToCache) 152 if (addToCache)
153 { 153 {
154 commsManager.AssetCache.AddAsset(asset); 154 commsManager.AssetCache.AddAsset(asset);
155 } 155 }
156 156
157 userInfo.UpdateItem(remoteClient.AgentId, item); 157 userInfo.UpdateItem(remoteClient.AgentId, item);
158 } 158 }
159 } 159 }
160 } 160 }
161 } 161 }
162 } 162 }
163 } 163 }
164 } 164 }
165 165
166 /// <summary> 166 /// <summary>
167 /// temporary method to test out creating new inventory items 167 /// temporary method to test out creating new inventory items
168 /// </summary> 168 /// </summary>
169 /// <param name="remoteClient"></param> 169 /// <param name="remoteClient"></param>
170 /// <param name="transActionID"></param> 170 /// <param name="transActionID"></param>
171 /// <param name="folderID"></param> 171 /// <param name="folderID"></param>
172 /// <param name="callbackID"></param> 172 /// <param name="callbackID"></param>
173 /// <param name="description"></param> 173 /// <param name="description"></param>
174 /// <param name="name"></param> 174 /// <param name="name"></param>
175 /// <param name="invType"></param> 175 /// <param name="invType"></param>
176 /// <param name="type"></param> 176 /// <param name="type"></param>
177 /// <param name="wearableType"></param> 177 /// <param name="wearableType"></param>
178 /// <param name="nextOwnerMask"></param> 178 /// <param name="nextOwnerMask"></param>
179 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, 179 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
180 uint callbackID, string description, string name, sbyte invType, sbyte type, 180 uint callbackID, string description, string name, sbyte invType, sbyte type,
181 byte wearableType, uint nextOwnerMask) 181 byte wearableType, uint nextOwnerMask)
182 { 182 {
183 if (transActionID == LLUUID.Zero) 183 if (transActionID == LLUUID.Zero)
184 { 184 {
185 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 185 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
186 if (userInfo != null) 186 if (userInfo != null)
187 { 187 {
188 AssetBase asset = new AssetBase(); 188 AssetBase asset = new AssetBase();
189 asset.Name = name; 189 asset.Name = name;
190 asset.Description = description; 190 asset.Description = description;
191 asset.InvType = invType; 191 asset.InvType = invType;
192 asset.Type = type; 192 asset.Type = type;
193 asset.FullID = LLUUID.Random(); 193 asset.FullID = LLUUID.Random();
194 asset.Data = new byte[1]; 194 asset.Data = new byte[1];
195 commsManager.AssetCache.AddAsset(asset); 195 commsManager.AssetCache.AddAsset(asset);
196 196
197 InventoryItemBase item = new InventoryItemBase(); 197 InventoryItemBase item = new InventoryItemBase();
198 item.avatarID = remoteClient.AgentId; 198 item.avatarID = remoteClient.AgentId;
199 item.creatorsID = remoteClient.AgentId; 199 item.creatorsID = remoteClient.AgentId;
200 item.inventoryID = LLUUID.Random(); 200 item.inventoryID = LLUUID.Random();
201 item.assetID = asset.FullID; 201 item.assetID = asset.FullID;
202 item.inventoryDescription = description; 202 item.inventoryDescription = description;
203 item.inventoryName = name; 203 item.inventoryName = name;
204 item.assetType = invType; 204 item.assetType = invType;
205 item.invType = invType; 205 item.invType = invType;
206 item.parentFolderID = folderID; 206 item.parentFolderID = folderID;
207 item.inventoryCurrentPermissions = 2147483647; 207 item.inventoryCurrentPermissions = 2147483647;
208 item.inventoryNextPermissions = nextOwnerMask; 208 item.inventoryNextPermissions = nextOwnerMask;
209 209
210 userInfo.AddItem(remoteClient.AgentId, item); 210 userInfo.AddItem(remoteClient.AgentId, item);
211 remoteClient.SendInventoryItemUpdate(item); 211 remoteClient.SendInventoryItemUpdate(item);
212 } 212 }
213 } 213 }
214 else 214 else
215 { 215 {
216 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, 216 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
217 callbackID, description, name, invType, 217 callbackID, description, name, invType,
218 type, wearableType, nextOwnerMask); 218 type, wearableType, nextOwnerMask);
219 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 219 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
220 } 220 }
221 } 221 }
222 222
223 /// <summary> 223 /// <summary>
224 /// 224 ///
225 /// </summary> 225 /// </summary>
226 /// <param name="remoteClient"></param> 226 /// <param name="remoteClient"></param>
227 /// <param name="primLocalID"></param> 227 /// <param name="primLocalID"></param>
228 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) 228 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
229 { 229 {
230 bool hasPrim = false; 230 bool hasPrim = false;
231 foreach (EntityBase ent in Entities.Values) 231 foreach (EntityBase ent in Entities.Values)
232 { 232 {
233 if (ent is SceneObjectGroup) 233 if (ent is SceneObjectGroup)
234 { 234 {
235 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); 235 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
236 if (hasPrim != false) 236 if (hasPrim != false)
237 { 237 {
238 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); 238 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
239 if (fileChange) 239 if (fileChange)
240 { 240 {
241 if (XferManager != null) 241 if (XferManager != null)
242 { 242 {
243 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); 243 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
244 } 244 }
245 } 245 }
246 break; 246 break;
247 } 247 }
248 } 248 }
249 } 249 }
250 } 250 }
251 251
252 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) 252 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
253 { 253 {
254 bool hasPrim = false; 254 bool hasPrim = false;
255 foreach (EntityBase ent in Entities.Values) 255 foreach (EntityBase ent in Entities.Values)
256 { 256 {
257 if (ent is SceneObjectGroup) 257 if (ent is SceneObjectGroup)
258 { 258 {
259 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 259 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
260 if (hasPrim != false) 260 if (hasPrim != false)
261 { 261 {
262 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); 262 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
263 ((SceneObjectGroup) ent).GetProperites(remoteClient); 263 ((SceneObjectGroup) ent).GetProperites(remoteClient);
264 if (type == 10) 264 if (type == 10)
265 { 265 {
266 EventManager.TriggerRemoveScript(localID, itemID); 266 EventManager.TriggerRemoveScript(localID, itemID);
267 } 267 }
268 } 268 }
269 } 269 }
270 } 270 }
271 } 271 }
272 272
273 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) 273 public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
274 { 274 {
275 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 275 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
276 LLUUID copyID = LLUUID.Random(); 276 LLUUID copyID = LLUUID.Random();
277 if (userInfo != null) 277 if (userInfo != null)
278 { 278 {
279 if (userInfo.RootFolder != null) 279 if (userInfo.RootFolder != null)
280 { 280 {
281 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 281 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
282 if (item != null) 282 if (item != null)
283 { 283 {
284 bool isTexture = false; 284 bool isTexture = false;
285 bool rezzed = false; 285 bool rezzed = false;
286 if (item.invType == 0) 286 if (item.invType == 0)
287 { 287 {
288 isTexture = true; 288 isTexture = true;
289 } 289 }
290 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 290 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
291 if (rezAsset != null) 291 if (rezAsset != null)
292 { 292 {
293 string script = Util.FieldToString(rezAsset.Data); 293 string script = Util.FieldToString(rezAsset.Data);
294 //Console.WriteLine("rez script "+script); 294 //Console.WriteLine("rez script "+script);
295 EventManager.TriggerRezScript(localID, copyID, script); 295 EventManager.TriggerRezScript(localID, copyID, script);
296 rezzed = true; 296 rezzed = true;
297 } 297 }
298 else 298 else
299 { 299 {
300 //lets try once more incase the asset cache is being slow getting the asset from server 300 //lets try once more incase the asset cache is being slow getting the asset from server
301 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); 301 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
302 if (rezAsset != null) 302 if (rezAsset != null)
303 { 303 {
304 string script = Util.FieldToString(rezAsset.Data); 304 string script = Util.FieldToString(rezAsset.Data);
305 // Console.WriteLine("rez script " + script); 305 // Console.WriteLine("rez script " + script);
306 EventManager.TriggerRezScript(localID, copyID, script); 306 EventManager.TriggerRezScript(localID, copyID, script);
307 rezzed = true; 307 rezzed = true;
308 } 308 }
309 } 309 }
310 310
311 if (rezzed) 311 if (rezzed)
312 { 312 {
313 bool hasPrim = false; 313 bool hasPrim = false;
314 foreach (EntityBase ent in Entities.Values) 314 foreach (EntityBase ent in Entities.Values)
315 { 315 {
316 if (ent is SceneObjectGroup) 316 if (ent is SceneObjectGroup)
317 { 317 {
318 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 318 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
319 if (hasPrim != false) 319 if (hasPrim != false)
320 { 320 {
321 bool added = 321 bool added =
322 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, 322 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
323 copyID); 323 copyID);
324 ((SceneObjectGroup) ent).GetProperites(remoteClient); 324 ((SceneObjectGroup) ent).GetProperites(remoteClient);
325 } 325 }
326 } 326 }
327 } 327 }
328 } 328 }
329 } 329 }
330 } 330 }
331 } 331 }
332 } 332 }
333 333
334 /// <summary> 334 /// <summary>
335 /// 335 ///
336 /// </summary> 336 /// </summary>
337 /// <param name="packet"></param> 337 /// <param name="packet"></param>
338 /// <param name="simClient"></param> 338 /// <param name="simClient"></param>
339 public void DeRezObject(Packet packet, IClientAPI remoteClient) 339 public void DeRezObject(Packet packet, IClientAPI remoteClient)
340 { 340 {
341 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; 341 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
342 342
343 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 343 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
344 { 344 {
345 //currently following code not used (or don't know of any case of destination being zero 345 //currently following code not used (or don't know of any case of destination being zero
346 } 346 }
347 else 347 else
348 { 348 {
349 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) 349 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
350 { 350 {
351 EntityBase selectedEnt = null; 351 EntityBase selectedEnt = null;
352 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 352 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
353 foreach (EntityBase ent in Entities.Values) 353 foreach (EntityBase ent in Entities.Values)
354 { 354 {
355 if (ent.LocalId == Data.ObjectLocalID) 355 if (ent.LocalId == Data.ObjectLocalID)
356 { 356 {
357 selectedEnt = ent; 357 selectedEnt = ent;
358 break; 358 break;
359 } 359 }
360 } 360 }
361 if (selectedEnt != null) 361 if (selectedEnt != null)
362 { 362 {
363 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) 363 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
364 { 364 {
365 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); 365 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
366 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 366 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
367 if (userInfo != null) 367 if (userInfo != null)
368 { 368 {
369 AssetBase asset = new AssetBase(); 369 AssetBase asset = new AssetBase();
370 asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); 370 asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
371 asset.Description = 371 asset.Description =
372 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); 372 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
373 asset.InvType = 6; 373 asset.InvType = 6;
374 asset.Type = 6; 374 asset.Type = 6;
375 asset.FullID = LLUUID.Random(); 375 asset.FullID = LLUUID.Random();
376 asset.Data = Helpers.StringToField(sceneObjectXml); 376 asset.Data = Helpers.StringToField(sceneObjectXml);
377 commsManager.AssetCache.AddAsset(asset); 377 commsManager.AssetCache.AddAsset(asset);
378 378
379 379
380 InventoryItemBase item = new InventoryItemBase(); 380 InventoryItemBase item = new InventoryItemBase();
381 item.avatarID = remoteClient.AgentId; 381 item.avatarID = remoteClient.AgentId;
382 item.creatorsID = remoteClient.AgentId; 382 item.creatorsID = remoteClient.AgentId;
383 item.inventoryID = LLUUID.Random(); 383 item.inventoryID = LLUUID.Random();
384 item.assetID = asset.FullID; 384 item.assetID = asset.FullID;
385 item.inventoryDescription = asset.Description; 385 item.inventoryDescription = asset.Description;
386 item.inventoryName = asset.Name; 386 item.inventoryName = asset.Name;
387 item.assetType = asset.Type; 387 item.assetType = asset.Type;
388 item.invType = asset.InvType; 388 item.invType = asset.InvType;
389 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; 389 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
390 item.inventoryCurrentPermissions = 2147483647; 390 item.inventoryCurrentPermissions = 2147483647;
391 item.inventoryNextPermissions = 2147483647; 391 item.inventoryNextPermissions = 2147483647;
392 392
393 userInfo.AddItem(remoteClient.AgentId, item); 393 userInfo.AddItem(remoteClient.AgentId, item);
394 remoteClient.SendInventoryItemUpdate(item); 394 remoteClient.SendInventoryItemUpdate(item);
395 } 395 }
396 396
397 DeleteSceneObjectGroup((SceneObjectGroup)selectedEnt); 397 DeleteSceneObjectGroup((SceneObjectGroup)selectedEnt);
398 } 398 }
399 } 399 }
400 } 400 }
401 } 401 }
402 } 402 }
403 403
404 public void DeleteSceneObjectGroup(SceneObjectGroup group) 404 public void DeleteSceneObjectGroup(SceneObjectGroup group)
405 { 405 {
406 SceneObjectPart rootPart = (group).GetChildPart(group.UUID); 406 SceneObjectPart rootPart = (group).GetChildPart(group.UUID);
407 if (rootPart.PhysActor != null) 407 if (rootPart.PhysActor != null)
408 { 408 {
409 phyScene.RemovePrim(rootPart.PhysActor); 409 phyScene.RemovePrim(rootPart.PhysActor);
410 rootPart.PhysActor = null; 410 rootPart.PhysActor = null;
411 } 411 }
412 412
413 storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID); 413 storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID);
414 group.DeleteGroup(); 414 group.DeleteGroup();
415 415
416 lock (Entities) 416 lock (Entities)
417 { 417 {
418 Entities.Remove(group.UUID); 418 Entities.Remove(group.UUID);
419 } 419 }
420 group.DeleteParts(); 420 group.DeleteParts();
421 } 421 }
422 422
423 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) 423 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
424 { 424 {
425 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 425 CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
426 if (userInfo != null) 426 if (userInfo != null)
427 { 427 {
428 if (userInfo.RootFolder != null) 428 if (userInfo.RootFolder != null)
429 { 429 {
430 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 430 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
431 if (item != null) 431 if (item != null)
432 { 432 {
433 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 433 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
434 if (rezAsset != null) 434 if (rezAsset != null)
435 { 435 {
436 AddRezObject(Util.FieldToString(rezAsset.Data), pos); 436 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
437 userInfo.DeleteItem(remoteClient.AgentId, item); 437 userInfo.DeleteItem(remoteClient.AgentId, item);
438 remoteClient.SendRemoveInventoryItem(itemID); 438 remoteClient.SendRemoveInventoryItem(itemID);
439 } 439 }
440 else 440 else
441 { 441 {
442 //lets try once more incase the asset cache is being slow getting the asset from server 442 //lets try once more incase the asset cache is being slow getting the asset from server
443 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 443 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
444 if (rezAsset != null) 444 if (rezAsset != null)
445 { 445 {
446 AddRezObject(Util.FieldToString(rezAsset.Data), pos); 446 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
447 userInfo.DeleteItem(remoteClient.AgentId, item); 447 userInfo.DeleteItem(remoteClient.AgentId, item);
448 remoteClient.SendRemoveInventoryItem(itemID); 448 remoteClient.SendRemoveInventoryItem(itemID);
449 } 449 }
450 } 450 }
451 } 451 }
452 } 452 }
453 } 453 }
454 } 454 }
455 455
456 private void AddRezObject(string xmlData, LLVector3 pos) 456 private void AddRezObject(string xmlData, LLVector3 pos)
457 { 457 {
458 SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); 458 SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
459 AddEntity(group); 459 AddEntity(group);
460 group.AbsolutePosition = pos; 460 group.AbsolutePosition = pos;
461 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 461 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
462 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 462 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
463 { 463 {
464 PrimitiveBaseShape pbs = rootPart.Shape; 464 PrimitiveBaseShape pbs = rootPart.Shape;
465 rootPart.PhysActor = phyScene.AddPrimShape( 465 rootPart.PhysActor = phyScene.AddPrimShape(
466 rootPart.Name, 466 rootPart.Name,
467 pbs, 467 pbs,
468 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 468 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
469 rootPart.AbsolutePosition.Z), 469 rootPart.AbsolutePosition.Z),
470 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 470 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
471 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 471 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
472 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 472 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
473 } 473 }
474 } 474 }
475 } 475 }
476} 476}
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
index 20bb51d..942ec4d 100644
--- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
+++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
@@ -1,258 +1,258 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31
32namespace OpenSim.Region.Environment.Types 32namespace OpenSim.Region.Environment.Types
33{ 33{
34 public class BasicQuadTreeNode 34 public class BasicQuadTreeNode
35 { 35 {
36 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); 36 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
37 private BasicQuadTreeNode[] m_childNodes = null; 37 private BasicQuadTreeNode[] m_childNodes = null;
38 private BasicQuadTreeNode m_parent = null; 38 private BasicQuadTreeNode m_parent = null;
39 39
40 private short m_leftX; 40 private short m_leftX;
41 private short m_leftY; 41 private short m_leftY;
42 private short m_width; 42 private short m_width;
43 private short m_height; 43 private short m_height;
44 //private int m_quadNumber; 44 //private int m_quadNumber;
45 private string m_quadID; 45 private string m_quadID;
46 46
47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height) 47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height)
48 { 48 {
49 m_parent = parent; 49 m_parent = parent;
50 m_quadID = quadID; 50 m_quadID = quadID;
51 m_leftX = leftX; 51 m_leftX = leftX;
52 m_leftY = leftY; 52 m_leftY = leftY;
53 m_width = width; 53 m_width = width;
54 m_height = height; 54 m_height = height;
55 // Console.WriteLine("creating quadtree node " + m_quadID); 55 // Console.WriteLine("creating quadtree node " + m_quadID);
56 } 56 }
57 57
58 public void AddObject(SceneObjectGroup obj) 58 public void AddObject(SceneObjectGroup obj)
59 { 59 {
60 if (m_childNodes == null) 60 if (m_childNodes == null)
61 { 61 {
62 if (!m_objects.Contains(obj)) 62 if (!m_objects.Contains(obj))
63 { 63 {
64 m_objects.Add(obj); 64 m_objects.Add(obj);
65 } 65 }
66 } 66 }
67 else 67 else
68 { 68 {
69 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) 69 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2)))
70 { 70 {
71 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 71 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
72 { 72 {
73 m_childNodes[0].AddObject(obj); 73 m_childNodes[0].AddObject(obj);
74 } 74 }
75 else 75 else
76 { 76 {
77 m_childNodes[2].AddObject(obj); 77 m_childNodes[2].AddObject(obj);
78 } 78 }
79 } 79 }
80 else 80 else
81 { 81 {
82 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 82 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
83 { 83 {
84 m_childNodes[1].AddObject(obj); 84 m_childNodes[1].AddObject(obj);
85 } 85 }
86 else 86 else
87 { 87 {
88 m_childNodes[3].AddObject(obj); 88 m_childNodes[3].AddObject(obj);
89 } 89 }
90 } 90 }
91 } 91 }
92 } 92 }
93 93
94 public void Subdivide() 94 public void Subdivide()
95 { 95 {
96 if (m_childNodes == null) 96 if (m_childNodes == null)
97 { 97 {
98 m_childNodes = new BasicQuadTreeNode[4]; 98 m_childNodes = new BasicQuadTreeNode[4];
99 m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 99 m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2));
100 m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 100 m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2));
101 m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 101 m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2));
102 m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 102 m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2));
103 } 103 }
104 else 104 else
105 { 105 {
106 for (int i = 0; i < m_childNodes.Length; i++) 106 for (int i = 0; i < m_childNodes.Length; i++)
107 { 107 {
108 m_childNodes[i].Subdivide(); 108 m_childNodes[i].Subdivide();
109 } 109 }
110 } 110 }
111 } 111 }
112 112
113 public List<SceneObjectGroup> GetObjectsFrom(float x, float y) 113 public List<SceneObjectGroup> GetObjectsFrom(float x, float y)
114 { 114 {
115 if (m_childNodes == null) 115 if (m_childNodes == null)
116 { 116 {
117 return new List<SceneObjectGroup>(m_objects); 117 return new List<SceneObjectGroup>(m_objects);
118 } 118 }
119 else 119 else
120 { 120 {
121 if (x < m_leftX + (m_width / 2)) 121 if (x < m_leftX + (m_width / 2))
122 { 122 {
123 if (y < m_leftY + (m_height / 2)) 123 if (y < m_leftY + (m_height / 2))
124 { 124 {
125 return m_childNodes[0].GetObjectsFrom(x, y); 125 return m_childNodes[0].GetObjectsFrom(x, y);
126 } 126 }
127 else 127 else
128 { 128 {
129 return m_childNodes[2].GetObjectsFrom(x, y); 129 return m_childNodes[2].GetObjectsFrom(x, y);
130 } 130 }
131 } 131 }
132 else 132 else
133 { 133 {
134 if (y < m_leftY + (m_height / 2)) 134 if (y < m_leftY + (m_height / 2))
135 { 135 {
136 return m_childNodes[1].GetObjectsFrom(x, y); 136 return m_childNodes[1].GetObjectsFrom(x, y);
137 } 137 }
138 else 138 else
139 { 139 {
140 return m_childNodes[3].GetObjectsFrom(x, y); 140 return m_childNodes[3].GetObjectsFrom(x, y);
141 } 141 }
142 } 142 }
143 } 143 }
144 } 144 }
145 145
146 public List<SceneObjectGroup> GetObjectsFrom(string nodeName) 146 public List<SceneObjectGroup> GetObjectsFrom(string nodeName)
147 { 147 {
148 if (nodeName == m_quadID) 148 if (nodeName == m_quadID)
149 { 149 {
150 return new List<SceneObjectGroup>(m_objects); 150 return new List<SceneObjectGroup>(m_objects);
151 } 151 }
152 else if (m_childNodes != null) 152 else if (m_childNodes != null)
153 { 153 {
154 for (int i = 0; i < 4; i++) 154 for (int i = 0; i < 4; i++)
155 { 155 {
156 List<SceneObjectGroup> retVal; 156 List<SceneObjectGroup> retVal;
157 retVal = m_childNodes[i].GetObjectsFrom(nodeName); 157 retVal = m_childNodes[i].GetObjectsFrom(nodeName);
158 if (retVal != null) 158 if (retVal != null)
159 { 159 {
160 return retVal; 160 return retVal;
161 } 161 }
162 } 162 }
163 } 163 }
164 return null; 164 return null;
165 } 165 }
166 166
167 public string GetNodeID(float x, float y) 167 public string GetNodeID(float x, float y)
168 { 168 {
169 if (m_childNodes == null) 169 if (m_childNodes == null)
170 { 170 {
171 return m_quadID; 171 return m_quadID;
172 } 172 }
173 else 173 else
174 { 174 {
175 if (x < m_leftX + (m_width / 2)) 175 if (x < m_leftX + (m_width / 2))
176 { 176 {
177 if (y < m_leftY + (m_height / 2)) 177 if (y < m_leftY + (m_height / 2))
178 { 178 {
179 return m_childNodes[0].GetNodeID(x, y); 179 return m_childNodes[0].GetNodeID(x, y);
180 } 180 }
181 else 181 else
182 { 182 {
183 return m_childNodes[2].GetNodeID(x, y); 183 return m_childNodes[2].GetNodeID(x, y);
184 } 184 }
185 } 185 }
186 else 186 else
187 { 187 {
188 if (y < m_leftY + (m_height / 2)) 188 if (y < m_leftY + (m_height / 2))
189 { 189 {
190 return m_childNodes[1].GetNodeID(x, y); 190 return m_childNodes[1].GetNodeID(x, y);
191 } 191 }
192 else 192 else
193 { 193 {
194 return m_childNodes[3].GetNodeID(x, y); 194 return m_childNodes[3].GetNodeID(x, y);
195 } 195 }
196 } 196 }
197 } 197 }
198 } 198 }
199 199
200 public void Update() 200 public void Update()
201 { 201 {
202 if (m_childNodes != null) 202 if (m_childNodes != null)
203 { 203 {
204 for (int i = 0; i < 4; i++) 204 for (int i = 0; i < 4; i++)
205 { 205 {
206 m_childNodes[i].Update(); 206 m_childNodes[i].Update();
207 } 207 }
208 } 208 }
209 else 209 else
210 { 210 {
211 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); 211 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
212 foreach (SceneObjectGroup group in m_objects) 212 foreach (SceneObjectGroup group in m_objects)
213 { 213 {
214 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 214 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
215 { 215 {
216 //still in bounds 216 //still in bounds
217 } 217 }
218 else 218 else
219 { 219 {
220 outBounds.Add(group); 220 outBounds.Add(group);
221 } 221 }
222 } 222 }
223 223
224 foreach (SceneObjectGroup removee in outBounds) 224 foreach (SceneObjectGroup removee in outBounds)
225 { 225 {
226 m_objects.Remove(removee); 226 m_objects.Remove(removee);
227 if (m_parent != null) 227 if (m_parent != null)
228 { 228 {
229 m_parent.PassUp(removee); 229 m_parent.PassUp(removee);
230 } 230 }
231 } 231 }
232 outBounds.Clear(); 232 outBounds.Clear();
233 } 233 }
234 } 234 }
235 235
236 public void PassUp(SceneObjectGroup group) 236 public void PassUp(SceneObjectGroup group)
237 { 237 {
238 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 238 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
239 { 239 {
240 AddObject(group); 240 AddObject(group);
241 } 241 }
242 else 242 else
243 { 243 {
244 if (m_parent != null) 244 if (m_parent != null)
245 { 245 {
246 m_parent.PassUp(group); 246 m_parent.PassUp(group);
247 } 247 }
248 } 248 }
249 } 249 }
250 250
251 public string[] GetNeighbours(string nodeName) 251 public string[] GetNeighbours(string nodeName)
252 { 252 {
253 string[] retVal = new string[1]; 253 string[] retVal = new string[1];
254 retVal[0] = ""; 254 retVal[0] = "";
255 return retVal; 255 return retVal;
256 } 256 }
257 } 257 }
258} 258}
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index b21bcb6..442e9d5 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -1,79 +1,79 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32 32
33namespace OpenSim.Region.Environment.Types 33namespace OpenSim.Region.Environment.Types
34{ 34{
35 public class UpdateQueue 35 public class UpdateQueue
36 { 36 {
37 private Queue<SceneObjectPart> m_queue; 37 private Queue<SceneObjectPart> m_queue;
38 38
39 private List<LLUUID> m_ids; 39 private List<LLUUID> m_ids;
40 40
41 public int Count 41 public int Count
42 { 42 {
43 get { return m_queue.Count; } 43 get { return m_queue.Count; }
44 } 44 }
45 45
46 public UpdateQueue() 46 public UpdateQueue()
47 { 47 {
48 m_queue = new Queue<SceneObjectPart>(); 48 m_queue = new Queue<SceneObjectPart>();
49 m_ids = new List<LLUUID>(); 49 m_ids = new List<LLUUID>();
50 } 50 }
51 51
52 public void Enqueue(SceneObjectPart part) 52 public void Enqueue(SceneObjectPart part)
53 { 53 {
54 lock (m_ids) 54 lock (m_ids)
55 { 55 {
56 if (!m_ids.Contains(part.UUID)) 56 if (!m_ids.Contains(part.UUID))
57 { 57 {
58 m_ids.Add(part.UUID); 58 m_ids.Add(part.UUID);
59 m_queue.Enqueue(part); 59 m_queue.Enqueue(part);
60 } 60 }
61 } 61 }
62 } 62 }
63 63
64 public SceneObjectPart Dequeue() 64 public SceneObjectPart Dequeue()
65 { 65 {
66 SceneObjectPart part = null; 66 SceneObjectPart part = null;
67 if (m_queue.Count > 0) 67 if (m_queue.Count > 0)
68 { 68 {
69 part = m_queue.Dequeue(); 69 part = m_queue.Dequeue();
70 lock (m_ids) 70 lock (m_ids)
71 { 71 {
72 m_ids.Remove(part.UUID); 72 m_ids.Remove(part.UUID);
73 } 73 }
74 } 74 }
75 75
76 return part; 76 return part;
77 } 77 }
78 } 78 }
79} 79}