diff options
author | Melanie | 2013-03-05 15:11:30 +0100 |
---|---|---|
committer | Melanie | 2013-03-05 15:11:30 +0100 |
commit | 9ffa08ea6b10d96a906b4896087ac3c2abd1b798 (patch) | |
tree | 42902d45882a16cefe6f8fda854610788566bb00 | |
parent | Multiattach, part 2 (diff) | |
download | opensim-SC_OLD-9ffa08ea6b10d96a906b4896087ac3c2abd1b798.zip opensim-SC_OLD-9ffa08ea6b10d96a906b4896087ac3c2abd1b798.tar.gz opensim-SC_OLD-9ffa08ea6b10d96a906b4896087ac3c2abd1b798.tar.bz2 opensim-SC_OLD-9ffa08ea6b10d96a906b4896087ac3c2abd1b798.tar.xz |
Limit each attachment point to 5 items as per spec
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 |
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. |