From 94e58ff6b9368975925cea4697077a8e59162bc0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 02:38:11 +0000 Subject: Use SP.ParentPart instead of ParentID in places where it's more efficient (saving extra null checks, etc.) However, it looks like we should retain SP.ParentID since it's much easier to use that in places where another thread could change ParentPart to null. Otherwise one has to clumsily put ParentPart in a reference, etc. to avoid a race. --- .../RegionCombinerModule/RegionCombinerModule.cs | 26 ++++++---------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 09da97a..a2e3ac2 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -716,29 +716,17 @@ namespace OpenSim.Region.RegionCombinerModule { if (sp.UUID != presence.UUID) { - if (sp.ParentID != 0) - { - // sitting avatar - SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID); - if (sop != null) - { - CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition); - AvatarUUIDs.Add(sp.UUID); - } - else - { - // we can't find the parent.. ! arg! - CoarseLocations.Add(sp.AbsolutePosition); - AvatarUUIDs.Add(sp.UUID); - } - } + SceneObjectPart sitPart = sp.ParentPart; + + if (sitPart != null) + CoarseLocations.Add(sitPart.AbsolutePosition + sp.AbsolutePosition); else - { CoarseLocations.Add(sp.AbsolutePosition); - AvatarUUIDs.Add(sp.UUID); - } + + AvatarUUIDs.Add(sp.UUID); } }); + DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); } -- cgit v1.1 From 06dda14505743bde237362b0e469d16548922f33 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 02:50:57 +0000 Subject: Simplify minimap coarse location code by just reference SP.AbsolutePosition This is rather than checking whether the avatar is sitting and doing its own calculation. --- OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index a2e3ac2..eb633b3 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -712,17 +712,12 @@ namespace OpenSim.Region.RegionCombinerModule List CoarseLocations = new List(); List AvatarUUIDs = new List(); + connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp) { if (sp.UUID != presence.UUID) { - SceneObjectPart sitPart = sp.ParentPart; - - if (sitPart != null) - CoarseLocations.Add(sitPart.AbsolutePosition + sp.AbsolutePosition); - else - CoarseLocations.Add(sp.AbsolutePosition); - + CoarseLocations.Add(sp.AbsolutePosition); AvatarUUIDs.Add(sp.UUID); } }); -- cgit v1.1