aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AvatarAppearance.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs23
1 files changed, 18 insertions, 5 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index be15e1b..c0bc47e 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -451,22 +451,33 @@ namespace OpenSim.Framework
451 /// 0x80 bit set then we assume this is an append 451 /// 0x80 bit set then we assume this is an append
452 /// operation otherwise we replace whatever is 452 /// operation otherwise we replace whatever is
453 /// currently attached at the attachpoint 453 /// currently attached at the attachpoint
454 /// return true if something actually changed
454 /// </summary> 455 /// </summary>
455 public void SetAttachment(int attachpoint, UUID item, UUID asset) 456 public bool SetAttachment(int attachpoint, UUID item, UUID asset)
456 { 457 {
457 if (attachpoint == 0) 458 if (attachpoint == 0)
458 return; 459 return false;
459 460
460 if (item == UUID.Zero) 461 if (item == UUID.Zero)
461 { 462 {
462 lock (m_attachments) 463 lock (m_attachments)
463 { 464 {
464 if (m_attachments.ContainsKey(attachpoint)) 465 if (m_attachments.ContainsKey(attachpoint))
466 {
465 m_attachments.Remove(attachpoint); 467 m_attachments.Remove(attachpoint);
466 return; 468 return true;
469 }
470 return false;
467 } 471 }
468 } 472 }
469 473
474 // check if the item is already attached at this point
475 if (GetAttachpoint(item) == (attachpoint & 0x7F))
476 {
477 // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item);
478 return false;
479 }
480
470 // check if this is an append or a replace, 0x80 marks it as an append 481 // check if this is an append or a replace, 0x80 marks it as an append
471 if ((attachpoint & 0x80) > 0) 482 if ((attachpoint & 0x80) > 0)
472 { 483 {
@@ -478,6 +489,7 @@ namespace OpenSim.Framework
478 { 489 {
479 ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); 490 ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset));
480 } 491 }
492 return true;
481 } 493 }
482 494
483 public int GetAttachpoint(UUID itemID) 495 public int GetAttachpoint(UUID itemID)
@@ -495,7 +507,7 @@ namespace OpenSim.Framework
495 } 507 }
496 } 508 }
497 509
498 public void DetachAttachment(UUID itemID) 510 public bool DetachAttachment(UUID itemID)
499 { 511 {
500 lock (m_attachments) 512 lock (m_attachments)
501 { 513 {
@@ -510,10 +522,11 @@ namespace OpenSim.Framework
510 // And remove the list if there are no more attachments here 522 // And remove the list if there are no more attachments here
511 if (m_attachments[kvp.Key].Count == 0) 523 if (m_attachments[kvp.Key].Count == 0)
512 m_attachments.Remove(kvp.Key); 524 m_attachments.Remove(kvp.Key);
513 return; 525 return true;
514 } 526 }
515 } 527 }
516 } 528 }
529 return false;
517 } 530 }
518 531
519 public void ClearAttachments() 532 public void ClearAttachments()