* 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; }
}
public LLUUID m_uuid;
protected LLUUID m_uuid;
public virtual LLUUID UUID
{

View File

@ -502,25 +502,12 @@ namespace OpenSim.Region.Environment.Scenes
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;
}
}

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

View File

@ -438,9 +438,9 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
string filename;
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)
{
@ -535,12 +535,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
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);
m_log.InfoFormat("[BALANCER] " + "scene presence deserialized [{0}]", sp.m_uuid);
m_log.InfoFormat("[BALANCER] " + "scene presence deserialized [{0}]", sp.UUID);
// restore the ClientView
@ -645,7 +645,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// remove all scene 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)
{
@ -666,7 +666,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
}
// remove scene presence
scene.RemoveClient(pre.m_uuid);
scene.RemoveClient(pre.UUID);
}
}