From f2b0377c28623ee915387fef37c88ab3b7694ba8 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 4 Jul 2012 21:49:21 +0100 Subject: [PATCH] refactor: In llGetInventoryCreator() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fce09bf6e4..338ae88cf1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9093,24 +9093,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_String llGetInventoryCreator(string item) + public LSL_String llGetInventoryCreator(string itemName) { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item == null) { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == item) - { - return inv.Value.CreatorID.ToString(); - } - } + llSay(0, "No item name '" + item + "'"); + + return String.Empty; } - llSay(0, "No item name '" + item + "'"); - - return String.Empty; + return item.CreatorID.ToString(); } public void llOwnerSay(string msg)