aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-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 f8fc483..ed4506c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -348,14 +348,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
348 348
349 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append) 349 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append)
350 { 350 {
351 // Remove any previous attachments
352 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); 351 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
353 352
354 // At the moment we can only deal with a single attachment 353 // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
355 if (attachments.Count != 0 && !append) 354 while (attachments.Count >= 5)
356 { 355 {
357 if (attachments[0].FromItemID != UUID.Zero) 356 if (attachments[0].FromItemID != UUID.Zero)
358 DetachSingleAttachmentToInvInternal(sp, attachments[0]); 357 DetachSingleAttachmentToInvInternal(sp, attachments[0]);
358 attachments.RemoveAt(0);
359 }
360
361 // If we're not appending, remove the rest as well
362 if (attachments.Count != 0 && !append)
363 {
364 foreach (SceneObjectGroup g in attachments)
365 {
366 if (g.FromItemID != UUID.Zero)
367 DetachSingleAttachmentToInvInternal(sp, g);
368 }
359 } 369 }
360 370
361 // Add the new attachment to inventory if we don't already have it. 371 // Add the new attachment to inventory if we don't already have it.