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
avinationmerge
Melanie Thielker 2010-04-25 22:03:35 +02:00
parent 899d521ab4
commit 81ff5eaba0
3 changed files with 35 additions and 14 deletions

View File

@ -215,5 +215,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// A <see cref="Dictionary`2"/>
/// </returns>
Dictionary<UUID, string> GetScriptStates();
Dictionary<UUID, string> GetScriptStates(bool oldIDs);
}
}

View File

@ -1040,6 +1040,11 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
public void SaveScriptedState(XmlTextWriter writer)
{
SaveScriptedState(writer, false);
}
public void SaveScriptedState(XmlTextWriter writer, bool oldIDs)
{
XmlDocument doc = new XmlDocument();
Dictionary<UUID,string> states = new Dictionary<UUID,string>();
@ -1050,7 +1055,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in m_parts.Values)
{
Dictionary<UUID,string> pstates = part.Inventory.GetScriptStates();
Dictionary<UUID,string> pstates = part.Inventory.GetScriptStates(oldIDs);
foreach (UUID itemid in pstates.Keys)
{
states.Add(itemid, pstates[itemid]);

View File

@ -311,11 +311,12 @@ namespace OpenSim.Region.Framework.Scenes
if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID);
lock (m_items)
{
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
}
m_items.LockItemsForWrite(true);
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
m_items.LockItemsForWrite(false);
string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
@ -713,15 +714,16 @@ namespace OpenSim.Region.Framework.Scenes
{
IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
lock (m_items)
m_items.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_items.Values)
{
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.Name == name)
items.Add(item);
}
if (item.Name == name)
items.Add(item);
}
m_items.LockItemsForRead(false);
return items;
}
@ -1114,6 +1116,11 @@ namespace OpenSim.Region.Framework.Scenes
}
public Dictionary<UUID, string> GetScriptStates()
{
return GetScriptStates(false);
}
public Dictionary<UUID, string> GetScriptStates(bool oldIDs)
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
@ -1132,8 +1139,16 @@ namespace OpenSim.Region.Framework.Scenes
string n = e.GetXMLState(item.ItemID);
if (n != String.Empty)
{
if (!ret.ContainsKey(item.ItemID))
ret[item.ItemID] = n;
if (oldIDs)
{
if (!ret.ContainsKey(item.OldItemID))
ret[item.OldItemID] = n;
}
else
{
if (!ret.ContainsKey(item.ItemID))
ret[item.ItemID] = n;
}
break;
}
}