From 3717812ce090cae850449ed82463545c079df68d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 4 Jul 2012 21:15:00 +0100 Subject: [PATCH] refactor: In llCollisionSound() use existing GetInventoryItem() method rather than have it iterate through TaskInventory itself. --- .../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 b52ebac0bc..ff4b690a19 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4290,18 +4290,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID soundId = UUID.Zero; if (!UUID.TryParse(impact_sound, out soundId)) { - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == (int)AssetType.Sound && item.Name == impact_sound) - { - soundId = item.AssetID; - break; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(impact_sound); + + if (item != null && item.Type == (int)AssetType.Sound) + soundId = item.AssetID; } + m_host.CollisionSound = soundId; m_host.CollisionSoundVolume = (float)impact_volume; }