diff options
author | Justin Clarke Casey | 2008-01-07 22:32:10 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-07 22:32:10 +0000 |
commit | 0428701da746df38ff7621b5c54f88afb0d48786 (patch) | |
tree | 76b67d2278273db7777d1542cdf74255b1cf4fd7 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |
parent | Trigger persistence of the scripts in a prim's inventory when that inventory ... (diff) | |
download | opensim-SC-0428701da746df38ff7621b5c54f88afb0d48786.zip opensim-SC-0428701da746df38ff7621b5c54f88afb0d48786.tar.gz opensim-SC-0428701da746df38ff7621b5c54f88afb0d48786.tar.bz2 opensim-SC-0428701da746df38ff7621b5c54f88afb0d48786.tar.xz |
Minor prim inventory method refactoring
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | 55 |
1 files changed, 20 insertions, 35 deletions
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 | |||
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) | 112 | /// <summary> |
113 | /// Add an inventory item to a prim in this group. | ||
114 | /// </summary> | ||
115 | /// <param name="remoteClient"></param> | ||
116 | /// <param name="localID"></param> | ||
117 | /// <param name="item"></param> | ||
118 | /// <param name="copyItemID">The item UUID that should be used by the new item.</param> | ||
119 | /// <returns></returns> | ||
120 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, | ||
121 | InventoryItemBase item, LLUUID copyItemID) | ||
113 | { | 122 | { |
123 | LLUUID newItemId = ((copyItemID != null) ? copyItemID : item.inventoryID); | ||
124 | |||
114 | SceneObjectPart part = GetChildPart(localID); | 125 | SceneObjectPart part = GetChildPart(localID); |
115 | if (part != null) | 126 | if (part != null) |
116 | { | 127 | { |
117 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 128 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
118 | taskItem.item_id = item.inventoryID; | 129 | |
130 | taskItem.item_id = newItemId; | ||
119 | taskItem.asset_id = item.assetID; | 131 | taskItem.asset_id = item.assetID; |
120 | taskItem.name = item.inventoryName; | 132 | taskItem.name = item.inventoryName; |
121 | taskItem.desc = item.inventoryDescription; | 133 | taskItem.desc = item.inventoryDescription; |
122 | taskItem.owner_id = item.avatarID; | 134 | taskItem.owner_id = item.avatarID; |
123 | taskItem.creator_id = item.creatorsID; | 135 | taskItem.creator_id = item.creatorsID; |
124 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | 136 | taskItem.type = TaskInventoryItem.Types[item.assetType]; |
125 | taskItem.inv_type = TaskInventoryItem.Types[item.invType]; | 137 | taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; |
126 | part.AddInventoryItem(taskItem); | 138 | part.AddInventoryItem(taskItem); |
127 | 139 | ||
128 | // It might seem somewhat crude to update the whole group for a single prim inventory change, | 140 | // 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 | |||
134 | 146 | ||
135 | return true; | 147 | return true; |
136 | } | 148 | } |
137 | return false; | ||
138 | } | ||
139 | |||
140 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) | ||
141 | { | ||
142 | if (copyItemID != LLUUID.Zero) | ||
143 | { | ||
144 | SceneObjectPart part = GetChildPart(localID); | ||
145 | if (part != null) | ||
146 | { | ||
147 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
148 | taskItem.item_id = copyItemID; | ||
149 | taskItem.asset_id = item.assetID; | ||
150 | taskItem.name = item.inventoryName; | ||
151 | taskItem.desc = item.inventoryDescription; | ||
152 | taskItem.owner_id = new LLUUID(item.avatarID.ToString()); | ||
153 | taskItem.creator_id = new LLUUID(item.creatorsID.ToString()); | ||
154 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | ||
155 | taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; | ||
156 | part.AddInventoryItem(taskItem); | ||
157 | |||
158 | // It might seem somewhat crude to update the whole group for a single prim inventory change, | ||
159 | // but it's possible that other prim inventory changes will take place before the region | ||
160 | // persistence thread visits this object. In the future, changes can be signalled at a more | ||
161 | // granular level, or we could let the datastore worry about whether prims have really | ||
162 | // changed since they were last persisted. | ||
163 | HasChanged = true; | ||
164 | |||
165 | return true; | ||
166 | } | ||
167 | } | ||
168 | else | 149 | else |
169 | { | 150 | { |
170 | return AddInventoryItem(remoteClient, localID, item); | 151 | MainLog.Instance.Error( |
152 | "PRIMINVENTORY", | ||
153 | "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}", | ||
154 | localID, Name, UUID, newItemId); | ||
171 | } | 155 | } |
156 | |||
172 | return false; | 157 | return false; |
173 | } | 158 | } |
174 | 159 | ||