refactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar

This does a tiny bit to reduce code complexity, memory requirement and the cpu time of pointlessly setting this field to the same value in every SOP
This commit is contained in:
Justin Clark-Casey (justincc)
2011-08-26 23:06:41 +01:00
parent 5f3ffc195f
commit 15a514fcbc
7 changed files with 26 additions and 27 deletions

View File

@@ -116,14 +116,13 @@ namespace OpenSim.Region.Framework.Scenes
return priority;
}
private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
{
// And anything attached to this avatar gets top priority as well
if (entity is SceneObjectPart)
{
SceneObjectPart sop = (SceneObjectPart)entity;
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
return 1;
}
@@ -136,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart)
{
SceneObjectPart sop = (SceneObjectPart)entity;
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
return 1;
}
@@ -149,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart)
{
SceneObjectPart sop = (SceneObjectPart)entity;
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
return 1;
}

View File

@@ -168,6 +168,14 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// The avatar to which this scene object is attached.
/// </summary>
/// <remarks>
/// If we're not attached to an avatar then this is UUID.Zero
/// </remarks>
public UUID AttachedAvatar { get; set; }
/// <summary>
/// Is this scene object phantom?
/// </summary>
@@ -1540,7 +1548,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null)
{
avatar.PushForce(impulse);
@@ -1622,7 +1630,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null)
{
avatar.MoveToTarget(target, false);

View File

@@ -221,9 +221,6 @@ namespace OpenSim.Region.Framework.Scenes
public scriptEvents AggregateScriptEvents;
public UUID AttachedAvatar;
public Vector3 AttachedPos;
@@ -728,7 +725,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsAttachment)
{
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
if (sp != null)
return sp.AbsolutePosition;
}