diff options
author | John Hurliman | 2010-09-16 17:30:46 -0700 |
---|---|---|
committer | John Hurliman | 2010-09-16 17:30:46 -0700 |
commit | 860b2a502f797e5822c6705d4639f370f3ac5861 (patch) | |
tree | 5a74ddbd626142e27f6c3439ea267b8ea348ce9c /OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |
parent | Add the modules include line back that i dropped by mistake (diff) | |
download | opensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.zip opensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.tar.gz opensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.tar.bz2 opensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.tar.xz |
Changed SceneObjectGroup to store parts with the fast and thread-safe MapAndArray collection
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 9a01a28..a86223c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -46,13 +46,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
46 | /// </summary> | 46 | /// </summary> |
47 | public void ForceInventoryPersistence() | 47 | public void ForceInventoryPersistence() |
48 | { | 48 | { |
49 | lock (m_parts) | 49 | SceneObjectPart[] parts = m_parts.GetArray(); |
50 | { | 50 | for (int i = 0; i < parts.Length; i++) |
51 | foreach (SceneObjectPart part in m_parts.Values) | 51 | parts[i].Inventory.ForceInventoryPersistence(); |
52 | { | ||
53 | part.Inventory.ForceInventoryPersistence(); | ||
54 | } | ||
55 | } | ||
56 | } | 52 | } |
57 | 53 | ||
58 | /// <summary> | 54 | /// <summary> |
@@ -64,10 +60,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
64 | // Don't start scripts if they're turned off in the region! | 60 | // Don't start scripts if they're turned off in the region! |
65 | if (!m_scene.RegionInfo.RegionSettings.DisableScripts) | 61 | if (!m_scene.RegionInfo.RegionSettings.DisableScripts) |
66 | { | 62 | { |
67 | foreach (SceneObjectPart part in m_parts.Values) | 63 | SceneObjectPart[] parts = m_parts.GetArray(); |
68 | { | 64 | for (int i = 0; i < parts.Length; i++) |
69 | part.Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource); | 65 | parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource); |
70 | } | ||
71 | } | 66 | } |
72 | } | 67 | } |
73 | 68 | ||
@@ -80,13 +75,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
80 | /// </param> | 75 | /// </param> |
81 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | 76 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) |
82 | { | 77 | { |
83 | lock (m_parts) | 78 | SceneObjectPart[] parts = m_parts.GetArray(); |
84 | { | 79 | for (int i = 0; i < parts.Length; i++) |
85 | foreach (SceneObjectPart part in m_parts.Values) | 80 | parts[i].Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); |
86 | { | ||
87 | part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); | ||
88 | } | ||
89 | } | ||
90 | } | 81 | } |
91 | 82 | ||
92 | /// <summary> | 83 | /// <summary> |
@@ -283,8 +274,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
283 | PermissionMask.Transfer) | 7; | 274 | PermissionMask.Transfer) | 7; |
284 | 275 | ||
285 | uint ownerMask = 0x7fffffff; | 276 | uint ownerMask = 0x7fffffff; |
286 | foreach (SceneObjectPart part in m_parts.Values) | 277 | |
278 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
279 | for (int i = 0; i < parts.Length; i++) | ||
287 | { | 280 | { |
281 | SceneObjectPart part = parts[i]; | ||
288 | ownerMask &= part.OwnerMask; | 282 | ownerMask &= part.OwnerMask; |
289 | perms &= part.Inventory.MaskEffectivePermissions(); | 283 | perms &= part.Inventory.MaskEffectivePermissions(); |
290 | } | 284 | } |
@@ -312,39 +306,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
312 | 306 | ||
313 | public void ApplyNextOwnerPermissions() | 307 | public void ApplyNextOwnerPermissions() |
314 | { | 308 | { |
315 | foreach (SceneObjectPart part in m_parts.Values) | 309 | SceneObjectPart[] parts = m_parts.GetArray(); |
316 | { | 310 | for (int i = 0; i < parts.Length; i++) |
317 | part.ApplyNextOwnerPermissions(); | 311 | parts[i].ApplyNextOwnerPermissions(); |
318 | } | ||
319 | } | 312 | } |
320 | 313 | ||
321 | public string GetStateSnapshot() | 314 | public string GetStateSnapshot() |
322 | { | 315 | { |
323 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); | 316 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); |
324 | 317 | ||
325 | foreach (SceneObjectPart part in m_parts.Values) | 318 | SceneObjectPart[] parts = m_parts.GetArray(); |
319 | for (int i = 0; i < parts.Length; i++) | ||
326 | { | 320 | { |
321 | SceneObjectPart part = parts[i]; | ||
327 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) | 322 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) |
328 | states[s.Key] = s.Value; | 323 | states[s.Key] = s.Value; |
329 | } | 324 | } |
330 | 325 | ||
331 | if (states.Count < 1) | 326 | if (states.Count < 1) |
332 | return ""; | 327 | return String.Empty; |
333 | 328 | ||
334 | XmlDocument xmldoc = new XmlDocument(); | 329 | XmlDocument xmldoc = new XmlDocument(); |
335 | 330 | ||
336 | XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, | 331 | XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, |
337 | "", ""); | 332 | String.Empty, String.Empty); |
338 | 333 | ||
339 | xmldoc.AppendChild(xmlnode); | 334 | xmldoc.AppendChild(xmlnode); |
340 | XmlElement rootElement = xmldoc.CreateElement("", "ScriptData", | 335 | XmlElement rootElement = xmldoc.CreateElement("", "ScriptData", |
341 | ""); | 336 | String.Empty); |
342 | 337 | ||
343 | xmldoc.AppendChild(rootElement); | 338 | xmldoc.AppendChild(rootElement); |
344 | 339 | ||
345 | 340 | ||
346 | XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates", | 341 | XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates", |
347 | ""); | 342 | String.Empty); |
348 | 343 | ||
349 | rootElement.AppendChild(wrapper); | 344 | rootElement.AppendChild(wrapper); |
350 | 345 | ||
@@ -424,10 +419,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
424 | 419 | ||
425 | public void ResumeScripts() | 420 | public void ResumeScripts() |
426 | { | 421 | { |
427 | foreach (SceneObjectPart part in m_parts.Values) | 422 | SceneObjectPart[] parts = m_parts.GetArray(); |
428 | { | 423 | for (int i = 0; i < parts.Length; i++) |
429 | part.Inventory.ResumeScripts(); | 424 | parts[i].Inventory.ResumeScripts(); |
430 | } | ||
431 | } | 425 | } |
432 | } | 426 | } |
433 | } | 427 | } |