aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-04-23 11:52:25 +0000
committerAdam Frisby2008-04-23 11:52:25 +0000
commitbca7ab7e363e9c9874a9ab137b60a042b9d1139c (patch)
tree52150bf5c1514fdad8ff086c84af8e6ae67cbb17 /OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
parent* Fix mantis #842 - folders which are created but left named "New Folder" in ... (diff)
downloadopensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.zip
opensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.tar.gz
opensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.tar.bz2
opensim-SC-bca7ab7e363e9c9874a9ab137b60a042b9d1139c.tar.xz
* Applying Mantis #1020 (Animations) - Thanks Melanie.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 72f78f3..9b99df7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -233,6 +233,33 @@ namespace OpenSim.Region.Environment.Scenes
233 } 233 }
234 } 234 }
235 235
236 // Assumes a lock is held on the inventory
237 private bool InventoryContainsName(string name)
238 {
239 foreach (TaskInventoryItem item in m_taskInventory.Values)
240 {
241 if(item.Name == name)
242 return true;
243 }
244 return false;
245 }
246
247 private string FindAvailableInventoryName(string name)
248 {
249 if(!InventoryContainsName(name))
250 return name;
251
252 int suffix=1;
253 while(suffix < 256)
254 {
255 string tryName=String.Format("{0} {1}", name, suffix);
256 if(!InventoryContainsName(tryName))
257 return tryName;
258 suffix++;
259 }
260 return String.Empty;
261 }
262
236 /// <summary> 263 /// <summary>
237 /// Add an item to this prim's inventory. 264 /// Add an item to this prim's inventory.
238 /// </summary> 265 /// </summary>
@@ -243,6 +270,12 @@ namespace OpenSim.Region.Environment.Scenes
243 item.CreationDate = 1000; 270 item.CreationDate = 1000;
244 item.ParentPartID = UUID; 271 item.ParentPartID = UUID;
245 272
273 string name=FindAvailableInventoryName(item.Name);
274 if(name == String.Empty)
275 return;
276
277 item.Name=name;
278
246 lock (m_taskInventory) 279 lock (m_taskInventory)
247 { 280 {
248 m_taskInventory.Add(item.ItemID, item); 281 m_taskInventory.Add(item.ItemID, item);