* Added null root part guard

* Normalized some UUID handling
* Compacted a few Contains/Add into Set
0.6.0-stable
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; } get { return m_scene; }
} }
public LLUUID m_uuid; protected LLUUID m_uuid;
public virtual LLUUID UUID public virtual LLUUID UUID
{ {

View File

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

View File

@ -123,7 +123,15 @@ namespace OpenSim.Region.Environment.Scenes
public override LLVector3 AbsolutePosition 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 set
{ {
LLVector3 val = value; LLVector3 val = value;

View File

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

View File

@ -438,9 +438,9 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
string filename; string filename;
IClientAPI controller = null; IClientAPI controller = null;
m_log.InfoFormat("[BALANCER] "+"agent id : {0}", pre.m_uuid); m_log.InfoFormat("[BALANCER] "+"agent id : {0}", pre.UUID);
uint[] circuits = scene.ClientManager.GetAllCircuits(pre.m_uuid); uint[] circuits = scene.ClientManager.GetAllCircuits(pre.UUID);
foreach (uint code in circuits) foreach (uint code in circuits)
{ {
@ -535,12 +535,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
sp = (ScenePresence)Util.DeserializeFromFile(filename); sp = (ScenePresence)Util.DeserializeFromFile(filename);
Console.WriteLine("agent id = {0}", sp.m_uuid); Console.WriteLine("agent id = {0}", sp.UUID);
scene.m_restorePresences.Add(sp.m_uuid, sp); scene.m_restorePresences.Add(sp.UUID, sp);
File.Delete(filename); File.Delete(filename);
m_log.InfoFormat("[BALANCER] " + "scene presence deserialized [{0}]", sp.m_uuid); m_log.InfoFormat("[BALANCER] " + "scene presence deserialized [{0}]", sp.UUID);
// restore the ClientView // restore the ClientView
@ -645,7 +645,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// remove all scene presences // remove all scene presences
foreach (ScenePresence pre in presences) foreach (ScenePresence pre in presences)
{ {
uint[] circuits = scene.ClientManager.GetAllCircuits(pre.m_uuid); uint[] circuits = scene.ClientManager.GetAllCircuits(pre.UUID);
foreach (uint code in circuits) foreach (uint code in circuits)
{ {
@ -666,7 +666,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
// remove scene presence // remove scene presence
scene.RemoveClient(pre.m_uuid); scene.RemoveClient(pre.UUID);
} }
} }