From 899d109e822bbf6084714842b460858f3939840b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 31 Aug 2011 17:13:53 +0100
Subject: get rid of appearance null checks - this is never null
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 50 +++++++---------------
.../Scenes/Tests/ScenePresenceAgentTests.cs | 1 +
OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 1 +
3 files changed, 17 insertions(+), 35 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 43a845c..cda2006 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -885,11 +885,8 @@ namespace OpenSim.Region.Framework.Scenes
}
float localAVHeight = 1.56f;
- if (m_appearance != null)
- {
- if (m_appearance.AvatarHeight > 0)
- localAVHeight = m_appearance.AvatarHeight;
- }
+ if (m_appearance.AvatarHeight > 0)
+ localAVHeight = m_appearance.AvatarHeight;
float posZLimit = 0;
@@ -903,25 +900,10 @@ namespace OpenSim.Region.Framework.Scenes
}
AbsolutePosition = pos;
- if (m_appearance != null)
- {
- if (m_appearance.AvatarHeight > 0)
- SetHeight(m_appearance.AvatarHeight);
- }
- else
- {
- m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName);
- // emergency; this really shouldn't happen
- m_appearance = new AvatarAppearance();
- }
-
- AddToPhysicalScene(isFlying);
+ if (m_appearance.AvatarHeight > 0)
+ SetHeight(m_appearance.AvatarHeight);
- if (m_appearance != null)
- {
- if (m_appearance.AvatarHeight > 0)
- SetHeight(m_appearance.AvatarHeight);
- }
+ AddToPhysicalScene(isFlying);
if (m_forceFly)
{
@@ -1053,11 +1035,10 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero;
AbsolutePosition = pos;
AddToPhysicalScene(isFlying);
- if (m_appearance != null)
- {
- if (m_appearance.AvatarHeight > 0)
- SetHeight(m_appearance.AvatarHeight);
- }
+
+ // FIXME: Move me into AddToPhysicalScene
+ if (m_appearance.AvatarHeight > 0)
+ SetHeight(m_appearance.AvatarHeight);
SendTerseUpdateToAllClients();
}
@@ -1071,11 +1052,9 @@ namespace OpenSim.Region.Framework.Scenes
RemoveFromPhysicalScene();
AbsolutePosition = pos;
AddToPhysicalScene(isFlying);
- if (m_appearance != null)
- {
- if (m_appearance.AvatarHeight > 0)
- SetHeight(m_appearance.AvatarHeight);
- }
+
+ if (m_appearance.AvatarHeight > 0)
+ SetHeight(m_appearance.AvatarHeight);
SendTerseUpdateToAllClients();
}
@@ -1129,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Event Handlers
///
- /// Sets avatar height in the phyiscs plugin
+ /// Sets avatar height in the physics plugin
///
public void SetHeight(float height)
{
@@ -1846,7 +1825,8 @@ namespace OpenSim.Region.Framework.Scenes
m_parentID = 0;
SendAvatarDataToAllAgents();
m_requestedSitTargetID = 0;
- if (m_physicsActor != null && m_appearance != null)
+
+ if (m_physicsActor != null)
{
if (m_appearance.AvatarHeight > 0)
SetHeight(m_appearance.AvatarHeight);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 35b41fb..ce9d418 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -357,6 +357,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.InventoryFolder = UUID.Zero;
agent.startpos = Vector3.Zero;
agent.CapsPath = GetRandomCapsObjectPath();
+ agent.Appearance = new AvatarAppearance();
acd1 = agent;
}
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 2cf40d7..ea433a6 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -357,6 +357,7 @@ namespace OpenSim.Tests.Common
agentData.startpos = Vector3.Zero;
agentData.CapsPath = "http://wibble.com";
agentData.ServiceURLs = new Dictionary();
+ agentData.Appearance = new AvatarAppearance();
return agentData;
}
--
cgit v1.1