JustinCC is evil. f7b28dd3 broke script persistence. This fixes it.

avinationmerge
root 2010-09-16 23:12:32 +02:00
parent 512ded6eb5
commit a0c87b5af6
4 changed files with 40 additions and 1 deletions

View File

@ -57,6 +57,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="linkNum">Link number for the part</param>
void ResetInventoryIDs();
/// <summary>
/// Reset parent object UUID for all the items in the prim's inventory.
/// </summary>
///
/// If this method is called and there are inventory items, then we regard the inventory as having changed.
///
/// <param name="linkNum">Link number for the part</param>
void ResetObjectID();
/// <summary>
/// Change every item in this inventory to a new owner.
/// </summary>

View File

@ -696,6 +696,7 @@ namespace OpenSim.Region.Framework.Scenes
if (node.Attributes["UUID"] != null)
{
UUID itemid = new UUID(node.Attributes["UUID"].Value);
m_log.DebugFormat("[SCRIPT STATE]: Adding state for oldID {0}", itemid);
m_savedScriptState.Add(itemid, node.InnerXml);
}
}

View File

@ -514,7 +514,7 @@ namespace OpenSim.Region.Framework.Scenes
// This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
if (Inventory != null)
Inventory.ResetInventoryIDs();
Inventory.ResetObjectID();
}
}
@ -2800,6 +2800,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random();
LinkNum = linkNum;
LocalId = 0;
Inventory.ResetInventoryIDs();
}
/// <summary>

View File

@ -148,6 +148,34 @@ namespace OpenSim.Region.Framework.Scenes
m_items.LockItemsForWrite(false);
}
public void ResetObjectID()
{
m_items.LockItemsForWrite(true);
if (Items.Count == 0)
{
m_items.LockItemsForWrite(false);
return;
}
HasInventoryChanged = true;
if (m_part.ParentGroup != null)
{
m_part.ParentGroup.HasGroupChanged = true;
}
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
Items.Clear();
foreach (TaskInventoryItem item in items)
{
item.ParentPartID = m_part.UUID;
item.ParentID = m_part.UUID;
Items.Add(item.ItemID, item);
}
m_items.LockItemsForWrite(false);
}
/// <summary>
/// Change every item in this inventory to a new owner.
/// </summary>