mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
@@ -1342,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public UUID SitTargetAvatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IDs of all avatars start on this object part.
|
||||
/// IDs of all avatars sat on this part.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We need to track this so that we can stop sat upon prims from being attached.
|
||||
@@ -5196,18 +5196,22 @@ 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)
|
||||
sittingAvatars = new HashSet<UUID>();
|
||||
|
||||
lock (sittingAvatars)
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
m_sittingAvatars = sittingAvatars;
|
||||
return m_sittingAvatars.Add(avatarId);
|
||||
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
|
||||
SitTargetAvatar = avatarId;
|
||||
|
||||
if (m_sittingAvatars == null)
|
||||
m_sittingAvatars = new HashSet<UUID>();
|
||||
|
||||
if (m_sittingAvatars.Add(avatarId))
|
||||
{
|
||||
ParentGroup.m_sittingAvatars.Add(avatarId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5221,27 +5225,26 @@ 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
|
||||
if (sittingAvatars == null)
|
||||
return false;
|
||||
|
||||
lock (sittingAvatars)
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
if (sittingAvatars.Remove(avatarId))
|
||||
if (SitTargetAvatar == avatarId)
|
||||
SitTargetAvatar = UUID.Zero;
|
||||
|
||||
if (m_sittingAvatars == null)
|
||||
return false;
|
||||
|
||||
if (m_sittingAvatars.Remove(avatarId))
|
||||
{
|
||||
if (sittingAvatars.Count == 0)
|
||||
if (m_sittingAvatars.Count == 0)
|
||||
m_sittingAvatars = null;
|
||||
|
||||
ParentGroup.m_sittingAvatars.Remove(avatarId);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -5251,16 +5254,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
|
||||
public HashSet<UUID> GetSittingAvatars()
|
||||
{
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
if (sittingAvatars == null)
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (sittingAvatars)
|
||||
return new HashSet<UUID>(sittingAvatars);
|
||||
if (m_sittingAvatars == null)
|
||||
return null;
|
||||
else
|
||||
return new HashSet<UUID>(m_sittingAvatars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5271,13 +5270,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns></returns>
|
||||
public int GetSittingAvatarsCount()
|
||||
{
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
if (sittingAvatars == null)
|
||||
return 0;
|
||||
|
||||
lock (sittingAvatars)
|
||||
return sittingAvatars.Count;
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
if (m_sittingAvatars == null)
|
||||
return 0;
|
||||
else
|
||||
return m_sittingAvatars.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user