diff options
author | Justin Clark-Casey (justincc) | 2012-07-17 22:56:21 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-17 22:56:21 +0100 |
commit | 59a29f5f221a1ffe4e22c63ef9da82270442b213 (patch) | |
tree | f924f1b92ff78cc64ac48dbf5dec173fa17d1ea6 /OpenSim/Region/ScriptEngine/Shared | |
parent | Restore update of inventory item on derez/logout. This is necessary to updat... (diff) | |
download | opensim-SC-59a29f5f221a1ffe4e22c63ef9da82270442b213.zip opensim-SC-59a29f5f221a1ffe4e22c63ef9da82270442b213.tar.gz opensim-SC-59a29f5f221a1ffe4e22c63ef9da82270442b213.tar.bz2 opensim-SC-59a29f5f221a1ffe4e22c63ef9da82270442b213.tar.xz |
Revert "refactor: make llGiveInventory() use existing GetInventoryItem() method rather than iterate through TaskInventory itself."
This reverts commit 58b13d51a7eddb442e38e6dc6790a9e7cf68bad7.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 35 |
1 files changed, 24 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 f88338d..c1ac0e5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3925,8 +3925,11 @@ 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 | 3928 | bool found = false; | |
3929 | UUID destId = UUID.Zero; | 3929 | UUID destId = UUID.Zero; |
3930 | UUID objId = UUID.Zero; | ||
3931 | int assetType = 0; | ||
3932 | string objName = String.Empty; | ||
3930 | 3933 | ||
3931 | if (!UUID.TryParse(destination, out destId)) | 3934 | if (!UUID.TryParse(destination, out destId)) |
3932 | { | 3935 | { |
@@ -3934,16 +3937,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3934 | return; | 3937 | return; |
3935 | } | 3938 | } |
3936 | 3939 | ||
3937 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); | 3940 | // move the first object found with this inventory name |
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 | } | ||
3938 | 3955 | ||
3939 | if (item == null) | 3956 | if (!found) |
3940 | { | 3957 | { |
3941 | llSay(0, String.Format("Could not find object '{0}'", inventory)); | 3958 | llSay(0, String.Format("Could not find object '{0}'", inventory)); |
3942 | throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); | 3959 | throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); |
3943 | } | 3960 | } |
3944 | 3961 | ||
3945 | UUID objId = item.ItemID; | ||
3946 | |||
3947 | // check if destination is an object | 3962 | // check if destination is an object |
3948 | if (World.GetSceneObjectPart(destId) != null) | 3963 | if (World.GetSceneObjectPart(destId) != null) |
3949 | { | 3964 | { |
@@ -3974,23 +3989,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3974 | return; | 3989 | return; |
3975 | 3990 | ||
3976 | byte[] bucket = new byte[17]; | 3991 | byte[] bucket = new byte[17]; |
3977 | bucket[0] = (byte)item.Type; | 3992 | bucket[0] = (byte)assetType; |
3978 | byte[] objBytes = agentItem.ID.GetBytes(); | 3993 | byte[] objBytes = agentItem.ID.GetBytes(); |
3979 | Array.Copy(objBytes, 0, bucket, 1, 16); | 3994 | Array.Copy(objBytes, 0, bucket, 1, 16); |
3980 | 3995 | ||
3981 | GridInstantMessage msg = new GridInstantMessage(World, | 3996 | GridInstantMessage msg = new GridInstantMessage(World, |
3982 | m_host.UUID, m_host.Name + ", an object owned by " + | 3997 | m_host.UUID, m_host.Name+", an object owned by "+ |
3983 | resolveName(m_host.OwnerID) + ",", destId, | 3998 | resolveName(m_host.OwnerID)+",", destId, |
3984 | (byte)InstantMessageDialog.TaskInventoryOffered, | 3999 | (byte)InstantMessageDialog.TaskInventoryOffered, |
3985 | false, item.Name + "\n" + m_host.Name + " is located at " + | 4000 | false, objName+"\n"+m_host.Name+" is located at "+ |
3986 | World.RegionInfo.RegionName+" "+ | 4001 | World.RegionInfo.RegionName+" "+ |
3987 | m_host.AbsolutePosition.ToString(), | 4002 | m_host.AbsolutePosition.ToString(), |
3988 | agentItem.ID, true, m_host.AbsolutePosition, | 4003 | agentItem.ID, true, m_host.AbsolutePosition, |
3989 | bucket); | 4004 | bucket); |
3990 | |||
3991 | if (m_TransferModule != null) | 4005 | if (m_TransferModule != null) |
3992 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); | 4006 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); |
3993 | |||
3994 | ScriptSleep(3000); | 4007 | ScriptSleep(3000); |
3995 | } | 4008 | } |
3996 | } | 4009 | } |