refactor: move management of SOP.SitTargetAvatar into SOP.AddSittingAvatar() and SOP.RemoveSittingAvatar()

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-10 23:50:04 +01:00
parent 11e0ad6dc8
commit cdea572d2e
2 changed files with 6 additions and 5 deletions

View File

@ -4525,6 +4525,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name='avatarId'></param>
protected internal bool AddSittingAvatar(UUID avatarId)
{
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
SitTargetAvatar = avatarId;
HashSet<UUID> sittingAvatars = m_sittingAvatars;
if (sittingAvatars == null)
@ -4547,6 +4550,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name='avatarId'></param>
protected internal bool RemoveSittingAvatar(UUID avatarId)
{
if (SitTargetAvatar == avatarId)
SitTargetAvatar = UUID.Zero;
HashSet<UUID> sittingAvatars = m_sittingAvatars;
// This can occur under a race condition where another thread

View File

@ -1799,10 +1799,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// Reset sit target.
if (part.SitTargetAvatar == UUID)
part.SitTargetAvatar = UUID.Zero;
ParentPosition = part.GetWorldPosition();
ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
@ -1884,7 +1880,6 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied",
// Name, part.Name, part.LocalId);
part.SitTargetAvatar = UUID;
offset = part.SitTargetPosition;
sitOrientation = part.SitTargetOrientation;
canSit = true;