From cf8adbe007fc311caec12d5c6f5f747c1c07201d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 4 Jul 2012 21:50:52 +0100 Subject: [PATCH] refactor: In llGetInventoryType() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6bdbae2eb7..c4c748de7b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9496,18 +9496,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - return inv.Value.Type; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); - return -1; + if (item == null) + return -1; + + return item.Type; } public void llSetPayPrice(int price, LSL_List quick_pay_buttons)