* Added null root part guard

* Normalized some UUID handling
* Compacted a few Contains/Add into Set
This commit is contained in:
lbsa71
2008-03-14 15:28:34 +00:00
parent 7ab08f2ac4
commit 24aedf52c6
5 changed files with 25 additions and 29 deletions

View File

@@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_scene; }
}
public LLUUID m_uuid;
protected LLUUID m_uuid;
public virtual LLUUID UUID
{

View File

@@ -489,40 +489,27 @@ namespace OpenSim.Region.Environment.Scenes
if (child)
{
m_numChildAgents++;
m_log.Info("[SCENE]"+ m_regInfo.RegionName + ": Creating new child agent.");
m_log.Info("[SCENE]" + m_regInfo.RegionName + ": Creating new child agent.");
}
else
{
m_numRootAgents++;
m_log.Info("[SCENE] "+ m_regInfo.RegionName + ": Creating new root agent.");
m_log.Info("[SCENE] "+ m_regInfo.RegionName + ": Adding Physical agent.");
m_log.Info("[SCENE] " + m_regInfo.RegionName + ": Creating new root agent.");
m_log.Info("[SCENE] " + m_regInfo.RegionName + ": Adding Physical agent.");
presence.AddToPhysicalScene();
}
lock (Entities)
{
if (!Entities.ContainsKey(presence.m_uuid))
{
Entities.Add(presence.m_uuid, presence);
}
else
{
Entities[presence.m_uuid] = presence;
}
Entities[presence.UUID] = presence;
}
lock (ScenePresences)
{
if (ScenePresences.ContainsKey(presence.m_uuid))
{
ScenePresences[presence.m_uuid] = presence;
}
else
{
ScenePresences.Add(presence.m_uuid, presence);
}
ScenePresences[presence.UUID] = presence;
}
}
}
public void SwapRootChildAgent(bool direction_RC_CR_T_F)
{

View File

@@ -123,7 +123,15 @@ namespace OpenSim.Region.Environment.Scenes
public override LLVector3 AbsolutePosition
{
get { return m_rootPart.GroupPosition; }
get
{
if( m_rootPart == null )
{
throw new NullReferenceException(string.Format("Object {0} has no root part.", m_uuid));
}
return m_rootPart.GroupPosition;
}
set
{
LLVector3 val = value;

View File

@@ -270,6 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
m_groupPosition.Y = PhysActor.Position.Y;
m_groupPosition.Z = PhysActor.Position.Z;
}
return m_groupPosition;
}
set