refactor: Add SOP.IsSitTargetOccupied to improve readability

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-10 23:34:40 +01:00
parent 69a6f6e3cd
commit c8f0d476d2
2 changed files with 8 additions and 3 deletions

View File

@ -135,6 +135,11 @@ namespace OpenSim.Region.Framework.Scenes
get { return ParentGroup.RootPart == this; } get { return ParentGroup.RootPart == this; }
} }
/// <summary>
/// Is the sit target of this part occupied?
/// </summary>
public bool IsSitTargetOccupied { get { return SitTargetAvatar != UUID.Zero; } }
/// <summary> /// <summary>
/// Is an explicit sit target set for this part? /// Is an explicit sit target set for this part?
/// </summary> /// </summary>
@ -736,7 +741,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
// TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
if (SitTargetAvatar != UUID.Zero) if (IsSitTargetOccupied)
{ {
ScenePresence avatar; ScenePresence avatar;
if (ParentGroup.Scene.TryGetScenePresence(SitTargetAvatar, out avatar)) if (ParentGroup.Scene.TryGetScenePresence(SitTargetAvatar, out avatar))

View File

@ -1846,7 +1846,7 @@ namespace OpenSim.Region.Framework.Scenes
//look for prims with explicit sit targets that are available //look for prims with explicit sit targets that are available
foreach (SceneObjectPart part in partArray) foreach (SceneObjectPart part in partArray)
{ {
if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) if (part.IsSitTargetSet && !part.IsSitTargetOccupied)
{ {
//switch the target to this prim //switch the target to this prim
return part; return part;
@ -1878,7 +1878,7 @@ namespace OpenSim.Region.Framework.Scenes
if (part.IsSitTargetSet) if (part.IsSitTargetSet)
{ {
if (part.SitTargetAvatar == UUID.Zero) if (!part.IsSitTargetOccupied)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied", // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied",