diff options
Merge branch 'master' into careminster-presence-refactor
Integrate the next large patch.
Don't use this version, it has a ghost avatar issue. Next push
will fix it.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index a7003c4..6cc7231 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 | lockPartsForRead(true); | 49 | SceneObjectPart[] parts = m_parts.GetArray(); |
50 | List<SceneObjectPart> values = new List<SceneObjectPart>(m_parts.Values); | 50 | for (int i = 0; i < parts.Length; i++) |
51 | lockPartsForRead(false); | 51 | parts[i].Inventory.ForceInventoryPersistence(); |
52 | foreach (SceneObjectPart part in values) | ||
53 | { | ||
54 | part.Inventory.ForceInventoryPersistence(); | ||
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 | ||
@@ -76,15 +71,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
76 | /// </summary> | 71 | /// </summary> |
77 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | 72 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) |
78 | { | 73 | { |
79 | lockPartsForRead(true); | 74 | SceneObjectPart[] parts = m_parts.GetArray(); |
80 | List<SceneObjectPart> values = new List<SceneObjectPart>(m_parts.Values); | 75 | for (int i = 0; i < parts.Length; i++) |
81 | lockPartsForRead(false); | 76 | parts[i].Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); |
82 | |||
83 | foreach (SceneObjectPart part in values) | ||
84 | { | ||
85 | part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); | ||
86 | } | ||
87 | |||
88 | } | 77 | } |
89 | 78 | ||
90 | /// <summary> | 79 | /// <summary> |
@@ -281,8 +270,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
281 | PermissionMask.Transfer) | 7; | 270 | PermissionMask.Transfer) | 7; |
282 | 271 | ||
283 | uint ownerMask = 0x7fffffff; | 272 | uint ownerMask = 0x7fffffff; |
284 | foreach (SceneObjectPart part in m_parts.Values) | 273 | |
274 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
275 | for (int i = 0; i < parts.Length; i++) | ||
285 | { | 276 | { |
277 | SceneObjectPart part = parts[i]; | ||
286 | ownerMask &= part.OwnerMask; | 278 | ownerMask &= part.OwnerMask; |
287 | perms &= part.Inventory.MaskEffectivePermissions(); | 279 | perms &= part.Inventory.MaskEffectivePermissions(); |
288 | } | 280 | } |
@@ -310,39 +302,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | 302 | ||
311 | public void ApplyNextOwnerPermissions() | 303 | public void ApplyNextOwnerPermissions() |
312 | { | 304 | { |
313 | foreach (SceneObjectPart part in m_parts.Values) | 305 | SceneObjectPart[] parts = m_parts.GetArray(); |
314 | { | 306 | for (int i = 0; i < parts.Length; i++) |
315 | part.ApplyNextOwnerPermissions(); | 307 | parts[i].ApplyNextOwnerPermissions(); |
316 | } | ||
317 | } | 308 | } |
318 | 309 | ||
319 | public string GetStateSnapshot() | 310 | public string GetStateSnapshot() |
320 | { | 311 | { |
321 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); | 312 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); |
322 | 313 | ||
323 | foreach (SceneObjectPart part in m_parts.Values) | 314 | SceneObjectPart[] parts = m_parts.GetArray(); |
315 | for (int i = 0; i < parts.Length; i++) | ||
324 | { | 316 | { |
317 | SceneObjectPart part = parts[i]; | ||
325 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) | 318 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) |
326 | states[s.Key] = s.Value; | 319 | states[s.Key] = s.Value; |
327 | } | 320 | } |
328 | 321 | ||
329 | if (states.Count < 1) | 322 | if (states.Count < 1) |
330 | return ""; | 323 | return String.Empty; |
331 | 324 | ||
332 | XmlDocument xmldoc = new XmlDocument(); | 325 | XmlDocument xmldoc = new XmlDocument(); |
333 | 326 | ||
334 | XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, | 327 | XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, |
335 | "", ""); | 328 | String.Empty, String.Empty); |
336 | 329 | ||
337 | xmldoc.AppendChild(xmlnode); | 330 | xmldoc.AppendChild(xmlnode); |
338 | XmlElement rootElement = xmldoc.CreateElement("", "ScriptData", | 331 | XmlElement rootElement = xmldoc.CreateElement("", "ScriptData", |
339 | ""); | 332 | String.Empty); |
340 | 333 | ||
341 | xmldoc.AppendChild(rootElement); | 334 | xmldoc.AppendChild(rootElement); |
342 | 335 | ||
343 | 336 | ||
344 | XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates", | 337 | XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates", |
345 | ""); | 338 | String.Empty); |
346 | 339 | ||
347 | rootElement.AppendChild(wrapper); | 340 | rootElement.AppendChild(wrapper); |
348 | 341 | ||
@@ -425,10 +418,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
425 | if (m_scene.RegionInfo.RegionSettings.DisableScripts) | 418 | if (m_scene.RegionInfo.RegionSettings.DisableScripts) |
426 | return; | 419 | return; |
427 | 420 | ||
428 | foreach (SceneObjectPart part in m_parts.Values) | 421 | SceneObjectPart[] parts = m_parts.GetArray(); |
429 | { | 422 | for (int i = 0; i < parts.Length; i++) |
430 | part.Inventory.ResumeScripts(); | 423 | parts[i].Inventory.ResumeScripts(); |
431 | } | ||
432 | } | 424 | } |
433 | } | 425 | } |
434 | } | 426 | } |