diff options
author | Melanie Thielker | 2010-04-25 22:03:35 +0200 |
---|---|---|
committer | Melanie Thielker | 2010-04-25 22:03:35 +0200 |
commit | 81ff5eaba09e7569ef5359874ffcfc7f8855f0b4 (patch) | |
tree | adbc99c0ac713afe3f8eeac686ab7045fc78f7ca | |
parent | Use the saved script states (diff) | |
download | opensim-SC-81ff5eaba09e7569ef5359874ffcfc7f8855f0b4.zip opensim-SC-81ff5eaba09e7569ef5359874ffcfc7f8855f0b4.tar.gz opensim-SC-81ff5eaba09e7569ef5359874ffcfc7f8855f0b4.tar.bz2 opensim-SC-81ff5eaba09e7569ef5359874ffcfc7f8855f0b4.tar.xz |
Make scripted attachment states work. Finally. Also replace two monitor locks
with RWLocks, hunting the 10^3 bug. Not successful, but needed to be done anyway
Diffstat (limited to '')
3 files changed, 35 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 4dd50d6..d893890 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -215,5 +215,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
215 | /// A <see cref="Dictionary`2"/> | 215 | /// A <see cref="Dictionary`2"/> |
216 | /// </returns> | 216 | /// </returns> |
217 | Dictionary<UUID, string> GetScriptStates(); | 217 | Dictionary<UUID, string> GetScriptStates(); |
218 | Dictionary<UUID, string> GetScriptStates(bool oldIDs); | ||
218 | } | 219 | } |
219 | } | 220 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 84c3719..1c6f2d1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1041,6 +1041,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1041 | 1041 | ||
1042 | public void SaveScriptedState(XmlTextWriter writer) | 1042 | public void SaveScriptedState(XmlTextWriter writer) |
1043 | { | 1043 | { |
1044 | SaveScriptedState(writer, false); | ||
1045 | } | ||
1046 | |||
1047 | public void SaveScriptedState(XmlTextWriter writer, bool oldIDs) | ||
1048 | { | ||
1044 | XmlDocument doc = new XmlDocument(); | 1049 | XmlDocument doc = new XmlDocument(); |
1045 | Dictionary<UUID,string> states = new Dictionary<UUID,string>(); | 1050 | Dictionary<UUID,string> states = new Dictionary<UUID,string>(); |
1046 | 1051 | ||
@@ -1050,7 +1055,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1050 | foreach (SceneObjectPart part in m_parts.Values) | 1055 | foreach (SceneObjectPart part in m_parts.Values) |
1051 | { | 1056 | { |
1052 | 1057 | ||
1053 | Dictionary<UUID,string> pstates = part.Inventory.GetScriptStates(); | 1058 | Dictionary<UUID,string> pstates = part.Inventory.GetScriptStates(oldIDs); |
1054 | foreach (UUID itemid in pstates.Keys) | 1059 | foreach (UUID itemid in pstates.Keys) |
1055 | { | 1060 | { |
1056 | states.Add(itemid, pstates[itemid]); | 1061 | states.Add(itemid, pstates[itemid]); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 04df35a..f875224 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -311,11 +311,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
311 | if (m_part.ParentGroup.m_savedScriptState != null) | 311 | if (m_part.ParentGroup.m_savedScriptState != null) |
312 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | 312 | RestoreSavedScriptState(item.OldItemID, item.ItemID); |
313 | 313 | ||
314 | lock (m_items) | 314 | m_items.LockItemsForWrite(true); |
315 | { | 315 | |
316 | m_items[item.ItemID].PermsMask = 0; | 316 | m_items[item.ItemID].PermsMask = 0; |
317 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 317 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
318 | } | 318 | |
319 | m_items.LockItemsForWrite(false); | ||
319 | 320 | ||
320 | string script = Utils.BytesToString(asset.Data); | 321 | string script = Utils.BytesToString(asset.Data); |
321 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 322 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
@@ -713,15 +714,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
713 | { | 714 | { |
714 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); | 715 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); |
715 | 716 | ||
716 | lock (m_items) | 717 | m_items.LockItemsForRead(true); |
718 | |||
719 | foreach (TaskInventoryItem item in m_items.Values) | ||
717 | { | 720 | { |
718 | foreach (TaskInventoryItem item in m_items.Values) | 721 | if (item.Name == name) |
719 | { | 722 | items.Add(item); |
720 | if (item.Name == name) | ||
721 | items.Add(item); | ||
722 | } | ||
723 | } | 723 | } |
724 | 724 | ||
725 | m_items.LockItemsForRead(false); | ||
726 | |||
725 | return items; | 727 | return items; |
726 | } | 728 | } |
727 | 729 | ||
@@ -1115,6 +1117,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1115 | 1117 | ||
1116 | public Dictionary<UUID, string> GetScriptStates() | 1118 | public Dictionary<UUID, string> GetScriptStates() |
1117 | { | 1119 | { |
1120 | return GetScriptStates(false); | ||
1121 | } | ||
1122 | |||
1123 | public Dictionary<UUID, string> GetScriptStates(bool oldIDs) | ||
1124 | { | ||
1118 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 1125 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
1119 | 1126 | ||
1120 | Dictionary<UUID, string> ret = new Dictionary<UUID, string>(); | 1127 | Dictionary<UUID, string> ret = new Dictionary<UUID, string>(); |
@@ -1132,8 +1139,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1132 | string n = e.GetXMLState(item.ItemID); | 1139 | string n = e.GetXMLState(item.ItemID); |
1133 | if (n != String.Empty) | 1140 | if (n != String.Empty) |
1134 | { | 1141 | { |
1135 | if (!ret.ContainsKey(item.ItemID)) | 1142 | if (oldIDs) |
1136 | ret[item.ItemID] = n; | 1143 | { |
1144 | if (!ret.ContainsKey(item.OldItemID)) | ||
1145 | ret[item.OldItemID] = n; | ||
1146 | } | ||
1147 | else | ||
1148 | { | ||
1149 | if (!ret.ContainsKey(item.ItemID)) | ||
1150 | ret[item.ItemID] = n; | ||
1151 | } | ||
1137 | break; | 1152 | break; |
1138 | } | 1153 | } |
1139 | } | 1154 | } |