aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs16
1 files changed, 13 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 9647217..7cc5092 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -381,14 +381,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
381 381
382 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append) 382 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append)
383 { 383 {
384 // Remove any previous attachments
385 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); 384 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
386 385
387 // At the moment we can only deal with a single attachment 386 // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
388 if (attachments.Count != 0 && !append) 387 while (attachments.Count >= 5)
389 { 388 {
390 if (attachments[0].FromItemID != UUID.Zero) 389 if (attachments[0].FromItemID != UUID.Zero)
391 DetachSingleAttachmentToInvInternal(sp, attachments[0]); 390 DetachSingleAttachmentToInvInternal(sp, attachments[0]);
391 attachments.RemoveAt(0);
392 }
393
394 // If we're not appending, remove the rest as well
395 if (attachments.Count != 0 && !append)
396 {
397 foreach (SceneObjectGroup g in attachments)
398 {
399 if (g.FromItemID != UUID.Zero)
400 DetachSingleAttachmentToInvInternal(sp, g);
401 }
392 } 402 }
393 403
394 // Add the new attachment to inventory if we don't already have it. 404 // Add the new attachment to inventory if we don't already have it.