Revert "Revert "refactor: make llGiveInventory() use existing GetInventoryItem() method rather than iterate through TaskInventory itself.""
This reverts commit 59a29f5f22
.
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
0.7.4.1
parent
ecb759c1e5
commit
48a5f10be1
|
@ -3925,11 +3925,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public void llGiveInventory(string destination, string inventory)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
bool found = false;
|
||||
|
||||
UUID destId = UUID.Zero;
|
||||
UUID objId = UUID.Zero;
|
||||
int assetType = 0;
|
||||
string objName = String.Empty;
|
||||
|
||||
if (!UUID.TryParse(destination, out destId))
|
||||
{
|
||||
|
@ -3937,28 +3934,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
}
|
||||
|
||||
// move the first object found with this inventory name
|
||||
lock (m_host.TaskInventory)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||
{
|
||||
if (inv.Value.Name == inventory)
|
||||
{
|
||||
found = true;
|
||||
objId = inv.Key;
|
||||
assetType = inv.Value.Type;
|
||||
objName = inv.Value.Name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
|
||||
|
||||
if (!found)
|
||||
if (item == null)
|
||||
{
|
||||
llSay(0, String.Format("Could not find object '{0}'", inventory));
|
||||
throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
|
||||
}
|
||||
|
||||
UUID objId = item.ItemID;
|
||||
|
||||
// check if destination is an object
|
||||
if (World.GetSceneObjectPart(destId) != null)
|
||||
{
|
||||
|
@ -3990,14 +3975,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
if (m_TransferModule != null)
|
||||
{
|
||||
byte[] bucket = new byte[] { (byte)assetType };
|
||||
byte[] bucket = new byte[] { (byte)item.Type };
|
||||
|
||||
GridInstantMessage msg = new GridInstantMessage(World,
|
||||
m_host.UUID, m_host.Name + ", an object owned by " +
|
||||
resolveName(m_host.OwnerID) + ",", destId,
|
||||
(byte)InstantMessageDialog.TaskInventoryOffered,
|
||||
false, objName + "\n" + m_host.Name + " is located at " +
|
||||
World.RegionInfo.RegionName + " " +
|
||||
false, item.Name + "\n" + m_host.Name + " is located at " +
|
||||
World.RegionInfo.RegionName+" "+
|
||||
m_host.AbsolutePosition.ToString(),
|
||||
agentItem.ID, true, m_host.AbsolutePosition,
|
||||
bucket);
|
||||
|
|
Loading…
Reference in New Issue