diff options
author | Dan Lake | 2010-03-19 05:51:16 -0700 |
---|---|---|
committer | John Hurliman | 2010-03-19 15:16:35 -0700 |
commit | 859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 (patch) | |
tree | dcce6c74d201b52c1a04ec9ec2cb90ce068fc020 /OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | |
parent | Inconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminati... (diff) | |
download | opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.zip opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.gz opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.bz2 opensim-SC-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.xz |
Cleaned up access to scenepresences in scenegraph. GetScenePresences and GetAvatars have been removed to consolidate locking and iteration within SceneGraph. All callers which used these to then iterate over presences have been refactored to instead pass their delegates to Scene.ForEachScenePresence(Action<ScenePresence>).
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 1a99c83..7a43537 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | |||
@@ -707,36 +707,37 @@ namespace OpenSim.Region.RegionCombinerModule | |||
707 | return; | 707 | return; |
708 | } | 708 | } |
709 | 709 | ||
710 | List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars(); | ||
711 | List<Vector3> CoarseLocations = new List<Vector3>(); | 710 | List<Vector3> CoarseLocations = new List<Vector3>(); |
712 | List<UUID> AvatarUUIDs = new List<UUID>(); | 711 | List<UUID> AvatarUUIDs = new List<UUID>(); |
713 | for (int i = 0; i < avatars.Count; i++) | 712 | connectiondata.RegionScene.ForEachScenePresence(delegate(ScenePresence sp) |
714 | { | 713 | { |
715 | if (avatars[i].UUID != presence.UUID) | 714 | if (sp.IsChildAgent) |
715 | return; | ||
716 | if (sp.UUID != presence.UUID) | ||
716 | { | 717 | { |
717 | if (avatars[i].ParentID != 0) | 718 | if (sp.ParentID != 0) |
718 | { | 719 | { |
719 | // sitting avatar | 720 | // sitting avatar |
720 | SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID); | 721 | SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID); |
721 | if (sop != null) | 722 | if (sop != null) |
722 | { | 723 | { |
723 | CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition); | 724 | CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition); |
724 | AvatarUUIDs.Add(avatars[i].UUID); | 725 | AvatarUUIDs.Add(sp.UUID); |
725 | } | 726 | } |
726 | else | 727 | else |
727 | { | 728 | { |
728 | // we can't find the parent.. ! arg! | 729 | // we can't find the parent.. ! arg! |
729 | CoarseLocations.Add(avatars[i].AbsolutePosition); | 730 | CoarseLocations.Add(sp.AbsolutePosition); |
730 | AvatarUUIDs.Add(avatars[i].UUID); | 731 | AvatarUUIDs.Add(sp.UUID); |
731 | } | 732 | } |
732 | } | 733 | } |
733 | else | 734 | else |
734 | { | 735 | { |
735 | CoarseLocations.Add(avatars[i].AbsolutePosition); | 736 | CoarseLocations.Add(sp.AbsolutePosition); |
736 | AvatarUUIDs.Add(avatars[i].UUID); | 737 | AvatarUUIDs.Add(sp.UUID); |
737 | } | 738 | } |
738 | } | 739 | } |
739 | } | 740 | }); |
740 | DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); | 741 | DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); |
741 | } | 742 | } |
742 | 743 | ||