From 859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 19 Mar 2010 05:51:16 -0700 Subject: 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). --- .../CoreModules/World/Land/LandManagementModule.cs | 39 ++++++++++------------ 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1279ac1..5750aa4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -191,9 +191,9 @@ namespace OpenSim.Region.CoreModules.World.Land forcedPosition = null; } //if we are far away, teleport - else if (Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3) + else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) { - Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); + Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); clientAvatar.Teleport(forcedPosition.Value); forcedPosition = null; } @@ -374,30 +374,27 @@ namespace OpenSim.Region.CoreModules.World.Land } } - public void SendOutNearestBanLine(IClientAPI avatar) + public void SendOutNearestBanLine(IClientAPI client) { - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence presence in avatars) + ScenePresence sp = m_scene.GetScenePresence(client.AgentId); + if (sp == null || sp.IsChildAgent) + return; + + List checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); + foreach (ILandObject checkBan in checkLandParcels) { - if (presence.UUID == avatar.AgentId) + if (checkBan.IsBannedFromLand(client.AgentId)) { - List checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); - foreach (ILandObject checkBan in checkLandParcels) - { - if (checkBan.IsBannedFromLand(avatar.AgentId)) - { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); - return; //Only send one - } - if (checkBan.IsRestrictedFromLand(avatar.AgentId)) - { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); - return; //Only send one - } - } - return; + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, client); + return; //Only send one + } + if (checkBan.IsRestrictedFromLand(client.AgentId)) + { + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, client); + return; //Only send one } } + return; } public void SendLandUpdate(ScenePresence avatar, bool force) -- cgit v1.1