aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorJeff Ames2007-11-07 02:42:18 +0000
committerJeff Ames2007-11-07 02:42:18 +0000
commitf86a65f14be58d6458efb2384a72180a0af8306d (patch)
treeb61d8123d4e3811688acc7900d19c7b044242897 /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
parent* Moved /branches/ruby to /trunk/share/ruby (diff)
downloadopensim-SC_OLD-f86a65f14be58d6458efb2384a72180a0af8306d.zip
opensim-SC_OLD-f86a65f14be58d6458efb2384a72180a0af8306d.tar.gz
opensim-SC_OLD-f86a65f14be58d6458efb2384a72180a0af8306d.tar.bz2
opensim-SC_OLD-f86a65f14be58d6458efb2384a72180a0af8306d.tar.xz
refactored some duplicate SceneObjectGroup searching code in Scene
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs70
1 files changed, 30 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 138cb20..f5e6f63 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -217,6 +217,19 @@ namespace OpenSim.Region.Environment.Scenes
217 } 217 }
218 } 218 }
219 219
220 private SceneObjectGroup GetGroupByPrim(uint localID)
221 {
222 foreach (EntityBase ent in Entities.Values)
223 {
224 if (ent is SceneObjectGroup)
225 {
226 if (((SceneObjectGroup)ent).HasChildPrim(localID))
227 return (SceneObjectGroup)ent;
228 }
229 }
230 return null;
231 }
232
220 /// <summary> 233 /// <summary>
221 /// 234 ///
222 /// </summary> 235 /// </summary>
@@ -224,23 +237,15 @@ namespace OpenSim.Region.Environment.Scenes
224 /// <param name="primLocalID"></param> 237 /// <param name="primLocalID"></param>
225 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) 238 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
226 { 239 {
227 bool hasPrim = false; 240 SceneObjectGroup group = GetGroupByPrim(primLocalID);
228 foreach (EntityBase ent in Entities.Values) 241 if (group != null)
229 { 242 {
230 if (ent is SceneObjectGroup) 243 bool fileChange = group.GetPartInventoryFileName(remoteClient, primLocalID);
244 if (fileChange)
231 { 245 {
232 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); 246 if (XferManager != null)
233 if (hasPrim != false)
234 { 247 {
235 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); 248 group.RequestInventoryFile(primLocalID, XferManager);
236 if (fileChange)
237 {
238 if (XferManager != null)
239 {
240 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
241 }
242 }
243 break;
244 } 249 }
245 } 250 }
246 } 251 }
@@ -248,21 +253,14 @@ namespace OpenSim.Region.Environment.Scenes
248 253
249 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) 254 public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
250 { 255 {
251 bool hasPrim = false; 256 SceneObjectGroup group = GetGroupByPrim(localID);
252 foreach (EntityBase ent in Entities.Values) 257 if (group != null)
253 { 258 {
254 if (ent is SceneObjectGroup) 259 int type = group.RemoveInventoryItem(remoteClient, localID, itemID);
260 group.GetProperites(remoteClient);
261 if (type == 10)
255 { 262 {
256 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 263 EventManager.TriggerRemoveScript(localID, itemID);
257 if (hasPrim != false)
258 {
259 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
260 ((SceneObjectGroup) ent).GetProperites(remoteClient);
261 if (type == 10)
262 {
263 EventManager.TriggerRemoveScript(localID, itemID);
264 }
265 }
266 } 264 }
267 } 265 }
268 } 266 }
@@ -307,20 +305,12 @@ namespace OpenSim.Region.Environment.Scenes
307 305
308 if (rezzed) 306 if (rezzed)
309 { 307 {
310 bool hasPrim = false; 308 SceneObjectGroup group = GetGroupByPrim(localID);
311 foreach (EntityBase ent in Entities.Values) 309 if (group != null)
312 { 310 {
313 if (ent is SceneObjectGroup) 311 // TODO: do we care about the value of this bool?
314 { 312 bool added = group.AddInventoryItem(remoteClient, localID, item, copyID);
315 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 313 group.GetProperites(remoteClient);
316 if (hasPrim != false)
317 {
318 bool added =
319 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
320 copyID);
321 ((SceneObjectGroup) ent).GetProperites(remoteClient);
322 }
323 }
324 } 314 }
325 } 315 }
326 } 316 }