From 0428701da746df38ff7621b5c54f88afb0d48786 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 7 Jan 2008 22:32:10 +0000
Subject: Minor prim inventory method refactoring
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 2 +-
.../Scenes/SceneObjectGroup.Inventory.cs | 55 ++++++++--------------
2 files changed, 21 insertions(+), 36 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index ed04e44..1a05bd9 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -524,7 +524,7 @@ namespace OpenSim.Region.Environment.Scenes
if (group != null)
{
// TODO Retrieve itemID from client's inventory to pass on
- //group.AddInventoryItem(rmoteClient, primLocalID, null);
+ //group.AddInventoryItem(remoteClient, primLocalID, null);
MainLog.Instance.Verbose(
"PRIMINVENTORY",
"UpdateTaskInventory called with script {0}, folder {1}, primLocalID {2}, user {3}",
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index fb09932..b72d743 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -109,20 +109,32 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item)
+ ///
+ /// Add an inventory item to a prim in this group.
+ ///
+ ///
+ ///
+ ///
+ /// The item UUID that should be used by the new item.
+ ///
+ public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
+ InventoryItemBase item, LLUUID copyItemID)
{
+ LLUUID newItemId = ((copyItemID != null) ? copyItemID : item.inventoryID);
+
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
TaskInventoryItem taskItem = new TaskInventoryItem();
- taskItem.item_id = item.inventoryID;
+
+ taskItem.item_id = newItemId;
taskItem.asset_id = item.assetID;
taskItem.name = item.inventoryName;
taskItem.desc = item.inventoryDescription;
taskItem.owner_id = item.avatarID;
taskItem.creator_id = item.creatorsID;
taskItem.type = TaskInventoryItem.Types[item.assetType];
- taskItem.inv_type = TaskInventoryItem.Types[item.invType];
+ taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType];
part.AddInventoryItem(taskItem);
// It might seem somewhat crude to update the whole group for a single prim inventory change,
@@ -134,41 +146,14 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
- return false;
- }
-
- public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
- {
- if (copyItemID != LLUUID.Zero)
- {
- SceneObjectPart part = GetChildPart(localID);
- if (part != null)
- {
- TaskInventoryItem taskItem = new TaskInventoryItem();
- taskItem.item_id = copyItemID;
- taskItem.asset_id = item.assetID;
- taskItem.name = item.inventoryName;
- taskItem.desc = item.inventoryDescription;
- taskItem.owner_id = new LLUUID(item.avatarID.ToString());
- taskItem.creator_id = new LLUUID(item.creatorsID.ToString());
- taskItem.type = TaskInventoryItem.Types[item.assetType];
- taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType];
- part.AddInventoryItem(taskItem);
-
- // It might seem somewhat crude to update the whole group for a single prim inventory change,
- // but it's possible that other prim inventory changes will take place before the region
- // persistence thread visits this object. In the future, changes can be signalled at a more
- // granular level, or we could let the datastore worry about whether prims have really
- // changed since they were last persisted.
- HasChanged = true;
-
- return true;
- }
- }
else
{
- return AddInventoryItem(remoteClient, localID, item);
+ MainLog.Instance.Error(
+ "PRIMINVENTORY",
+ "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
+ localID, Name, UUID, newItemId);
}
+
return false;
}
--
cgit v1.1