diff options
author | Justin Clark-Casey (justincc) | 2012-07-17 23:48:09 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-17 23:48:09 +0100 |
commit | 48a5f10be1a7e487690c1b4e7d220e26c53585c5 (patch) | |
tree | fd507306a2f66ac87341d978d954d19546e708b8 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Fix regression where llGiveInventory() had stopped asking non-owner receivers... (diff) | |
download | opensim-SC-48a5f10be1a7e487690c1b4e7d220e26c53585c5.zip opensim-SC-48a5f10be1a7e487690c1b4e7d220e26c53585c5.tar.gz opensim-SC-48a5f10be1a7e487690c1b4e7d220e26c53585c5.tar.bz2 opensim-SC-48a5f10be1a7e487690c1b4e7d220e26c53585c5.tar.xz |
Revert "Revert "refactor: make llGiveInventory() use existing GetInventoryItem() method rather than iterate through TaskInventory itself.""
This reverts commit 59a29f5f221a1ffe4e22c63ef9da82270442b213.
The original revert was committed by mistake - it turns out this was not the cause of Mantis 6089
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b43e8e7..084bd41 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3925,11 +3925,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3925 | public void llGiveInventory(string destination, string inventory) | 3925 | public void llGiveInventory(string destination, string inventory) |
3926 | { | 3926 | { |
3927 | m_host.AddScriptLPS(1); | 3927 | m_host.AddScriptLPS(1); |
3928 | bool found = false; | 3928 | |
3929 | UUID destId = UUID.Zero; | 3929 | UUID destId = UUID.Zero; |
3930 | UUID objId = UUID.Zero; | ||
3931 | int assetType = 0; | ||
3932 | string objName = String.Empty; | ||
3933 | 3930 | ||
3934 | if (!UUID.TryParse(destination, out destId)) | 3931 | if (!UUID.TryParse(destination, out destId)) |
3935 | { | 3932 | { |
@@ -3937,28 +3934,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3937 | return; | 3934 | return; |
3938 | } | 3935 | } |
3939 | 3936 | ||
3940 | // move the first object found with this inventory name | 3937 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); |
3941 | lock (m_host.TaskInventory) | ||
3942 | { | ||
3943 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
3944 | { | ||
3945 | if (inv.Value.Name == inventory) | ||
3946 | { | ||
3947 | found = true; | ||
3948 | objId = inv.Key; | ||
3949 | assetType = inv.Value.Type; | ||
3950 | objName = inv.Value.Name; | ||
3951 | break; | ||
3952 | } | ||
3953 | } | ||
3954 | } | ||
3955 | 3938 | ||
3956 | if (!found) | 3939 | if (item == null) |
3957 | { | 3940 | { |
3958 | llSay(0, String.Format("Could not find object '{0}'", inventory)); | 3941 | llSay(0, String.Format("Could not find object '{0}'", inventory)); |
3959 | throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); | 3942 | throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); |
3960 | } | 3943 | } |
3961 | 3944 | ||
3945 | UUID objId = item.ItemID; | ||
3946 | |||
3962 | // check if destination is an object | 3947 | // check if destination is an object |
3963 | if (World.GetSceneObjectPart(destId) != null) | 3948 | if (World.GetSceneObjectPart(destId) != null) |
3964 | { | 3949 | { |
@@ -3990,14 +3975,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3990 | 3975 | ||
3991 | if (m_TransferModule != null) | 3976 | if (m_TransferModule != null) |
3992 | { | 3977 | { |
3993 | byte[] bucket = new byte[] { (byte)assetType }; | 3978 | byte[] bucket = new byte[] { (byte)item.Type }; |
3994 | 3979 | ||
3995 | GridInstantMessage msg = new GridInstantMessage(World, | 3980 | GridInstantMessage msg = new GridInstantMessage(World, |
3996 | m_host.UUID, m_host.Name + ", an object owned by " + | 3981 | m_host.UUID, m_host.Name + ", an object owned by " + |
3997 | resolveName(m_host.OwnerID) + ",", destId, | 3982 | resolveName(m_host.OwnerID) + ",", destId, |
3998 | (byte)InstantMessageDialog.TaskInventoryOffered, | 3983 | (byte)InstantMessageDialog.TaskInventoryOffered, |
3999 | false, objName + "\n" + m_host.Name + " is located at " + | 3984 | false, item.Name + "\n" + m_host.Name + " is located at " + |
4000 | World.RegionInfo.RegionName + " " + | 3985 | World.RegionInfo.RegionName+" "+ |
4001 | m_host.AbsolutePosition.ToString(), | 3986 | m_host.AbsolutePosition.ToString(), |
4002 | agentItem.ID, true, m_host.AbsolutePosition, | 3987 | agentItem.ID, true, m_host.AbsolutePosition, |
4003 | bucket); | 3988 | bucket); |