From 0acac2f89091e437ca0e47054b60c8868aee9249 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 4 Jul 2012 21:33:35 +0100 Subject: [PATCH] refactor: replace use of LSL_Api.GetTaskInventoryItem() with existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 14be07b8d7..9ec4b24308 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6138,20 +6138,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - protected UUID GetTaskInventoryItem(string name) - { - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - return inv.Key; - } - } - - return UUID.Zero; - } - public void llGiveInventoryList(string destination, string category, LSL_List inventory) { m_host.AddScriptLPS(1); @@ -6164,16 +6150,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (Object item in inventory.Data) { + string rawItemString = item.ToString(); + UUID itemID; - if (UUID.TryParse(item.ToString(), out itemID)) + if (UUID.TryParse(rawItemString, out itemID)) { itemList.Add(itemID); } else { - itemID = GetTaskInventoryItem(item.ToString()); - if (itemID != UUID.Zero) - itemList.Add(itemID); + TaskInventoryItem taskItem = m_host.Inventory.GetInventoryItem(rawItemString); + + if (taskItem != null) + itemList.Add(taskItem.ItemID); } } @@ -6191,11 +6180,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Array.Copy(objBytes, 0, bucket, 1, 16); GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name+", an object owned by "+ - resolveName(m_host.OwnerID)+",", destID, + m_host.UUID, m_host.Name + ", an object owned by " + + resolveName(m_host.OwnerID) + ",", destID, (byte)InstantMessageDialog.InventoryOffered, - false, category+"\n"+m_host.Name+" is located at "+ - World.RegionInfo.RegionName+" "+ + false, category + "\n" + m_host.Name + " is located at " + + World.RegionInfo.RegionName + " " + m_host.AbsolutePosition.ToString(), folderID, true, m_host.AbsolutePosition, bucket);