diff options
author | Melanie | 2013-03-05 15:11:30 +0100 |
---|---|---|
committer | Melanie | 2013-03-18 22:56:26 +0000 |
commit | e4a70b9f9aa9d454c9b57c85452eec7f9d0d13e9 (patch) | |
tree | d041b5dbc1be09b6470af346e450254633a5ef64 /OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |
parent | Multiattach, part 2 (diff) | |
download | opensim-SC_OLD-e4a70b9f9aa9d454c9b57c85452eec7f9d0d13e9.zip opensim-SC_OLD-e4a70b9f9aa9d454c9b57c85452eec7f9d0d13e9.tar.gz opensim-SC_OLD-e4a70b9f9aa9d454c9b57c85452eec7f9d0d13e9.tar.bz2 opensim-SC_OLD-e4a70b9f9aa9d454c9b57c85452eec7f9d0d13e9.tar.xz |
Limit each attachment point to 5 items as per spec
Diffstat (limited to '')
-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 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. |