refactor: In llGetInventoryKey() use existing GetInventoryItem()

0.7.3-extended
Justin Clark-Casey (justincc) 2012-07-04 21:25:58 +01:00
parent aa1442b07e
commit 72554fc5b8
1 changed files with 9 additions and 15 deletions

View File

@ -4545,22 +4545,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
lock (m_host.TaskInventory) TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) if (item == null)
{
if (inv.Value.Name == name)
{
if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{
return inv.Value.AssetID.ToString();
}
else
{
return UUID.Zero.ToString(); return UUID.Zero.ToString();
}
} if ((item.CurrentPermissions
} & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
== (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{
return item.AssetID.ToString();
} }
return UUID.Zero.ToString(); return UUID.Zero.ToString();