diff options
author | Mic Bowman | 2011-01-25 14:23:58 -0800 |
---|---|---|
committer | Mic Bowman | 2011-01-25 14:23:58 -0800 |
commit | c4727645b864a92fc489427c516ccab3a21c2d91 (patch) | |
tree | 007117969b7defbb881a407aeb9a459c8bd40e07 /OpenSim/Framework | |
parent | Fix script data not being reset as it should be (diff) | |
download | opensim-SC-c4727645b864a92fc489427c516ccab3a21c2d91.zip opensim-SC-c4727645b864a92fc489427c516ccab3a21c2d91.tar.gz opensim-SC-c4727645b864a92fc489427c516ccab3a21c2d91.tar.bz2 opensim-SC-c4727645b864a92fc489427c516ccab3a21c2d91.tar.xz |
Removed a few more spurious appearance saves. When an avatar
enters a region the attachments module tries to update the
appearance with attachments that are already part of the appearance.
Just added a check to only save if the attachments weren't there
before.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 18a5733..5a6b265 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -427,19 +427,30 @@ namespace OpenSim.Framework | |||
427 | /// 0x80 bit set then we assume this is an append | 427 | /// 0x80 bit set then we assume this is an append |
428 | /// operation otherwise we replace whatever is | 428 | /// operation otherwise we replace whatever is |
429 | /// currently attached at the attachpoint | 429 | /// currently attached at the attachpoint |
430 | /// return true if something actually changed | ||
430 | /// </summary> | 431 | /// </summary> |
431 | public void SetAttachment(int attachpoint, UUID item, UUID asset) | 432 | public bool SetAttachment(int attachpoint, UUID item, UUID asset) |
432 | { | 433 | { |
433 | if (attachpoint == 0) | 434 | if (attachpoint == 0) |
434 | return; | 435 | return false; |
435 | 436 | ||
436 | if (item == UUID.Zero) | 437 | if (item == UUID.Zero) |
437 | { | 438 | { |
438 | if (m_attachments.ContainsKey(attachpoint)) | 439 | if (m_attachments.ContainsKey(attachpoint)) |
440 | { | ||
439 | m_attachments.Remove(attachpoint); | 441 | m_attachments.Remove(attachpoint); |
440 | return; | 442 | return true; |
443 | } | ||
444 | return false; | ||
441 | } | 445 | } |
442 | 446 | ||
447 | // check if the item is already attached at this point | ||
448 | if (GetAttachpoint(item) == (attachpoint & 0x7F)) | ||
449 | { | ||
450 | // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item); | ||
451 | return false; | ||
452 | } | ||
453 | |||
443 | // check if this is an append or a replace, 0x80 marks it as an append | 454 | // check if this is an append or a replace, 0x80 marks it as an append |
444 | if ((attachpoint & 0x80) > 0) | 455 | if ((attachpoint & 0x80) > 0) |
445 | { | 456 | { |
@@ -451,6 +462,7 @@ namespace OpenSim.Framework | |||
451 | { | 462 | { |
452 | ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); | 463 | ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); |
453 | } | 464 | } |
465 | return true; | ||
454 | } | 466 | } |
455 | 467 | ||
456 | public int GetAttachpoint(UUID itemID) | 468 | public int GetAttachpoint(UUID itemID) |
@@ -465,7 +477,7 @@ namespace OpenSim.Framework | |||
465 | return 0; | 477 | return 0; |
466 | } | 478 | } |
467 | 479 | ||
468 | public void DetachAttachment(UUID itemID) | 480 | public bool DetachAttachment(UUID itemID) |
469 | { | 481 | { |
470 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 482 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
471 | { | 483 | { |
@@ -478,9 +490,10 @@ namespace OpenSim.Framework | |||
478 | // And remove the list if there are no more attachments here | 490 | // And remove the list if there are no more attachments here |
479 | if (m_attachments[kvp.Key].Count == 0) | 491 | if (m_attachments[kvp.Key].Count == 0) |
480 | m_attachments.Remove(kvp.Key); | 492 | m_attachments.Remove(kvp.Key); |
481 | return; | 493 | return true; |
482 | } | 494 | } |
483 | } | 495 | } |
496 | return false; | ||
484 | } | 497 | } |
485 | 498 | ||
486 | public void ClearAttachments() | 499 | public void ClearAttachments() |