diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 66631b545e..fc5bb28398 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3426,7 +3426,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); loc.Header.Reliable = false; - // Each packet can only hold around 62 avatar positions and the client clears the mini-map each time + // Each packet can only hold around 60 avatar positions and the client clears the mini-map each time // a CoarseLocationUpdate packet is received. Oh well. int total = Math.Min(CoarseLocations.Count, 60); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1e3e0c9423..0707119eb8 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -865,9 +865,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); - // m_scene.SendKillObject(m_localId); - - agent.Scene.NotifyMyCoarseLocationChange(); // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4e90d09649..9a3b0c9752 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -348,6 +348,7 @@ namespace OpenSim.Region.Framework.Scenes private int m_update_backup = 200; private int m_update_terrain = 50; private int m_update_land = 1; + private int m_update_coarse_locations = 50; private int frameMS; private int physicsMS2; @@ -1417,6 +1418,18 @@ namespace OpenSim.Region.Framework.Scenes if (m_frame % m_update_presences == 0) m_sceneGraph.UpdatePresences(); + if (m_frame % m_update_coarse_locations == 0) + { + List coarseLocations; + List avatarUUIDs; + SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); + // Send coarse locations to clients + ForEachScenePresence(delegate(ScenePresence presence) + { + presence.SendCoarseLocations(coarseLocations, avatarUUIDs); + }); + } + int tmpPhysicsMS2 = Util.EnvironmentTickCount(); if ((m_frame % m_update_physics == 0) && m_physics_enabled) m_sceneGraph.UpdatePreparePhysics(); @@ -3301,9 +3314,6 @@ namespace OpenSim.Region.Framework.Scenes catch (NullReferenceException) { } }); - ForEachScenePresence( - delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); - IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); if (agentTransactions != null) { @@ -3355,14 +3365,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap. - /// - public void NotifyMyCoarseLocationChange() - { - ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); - } - #endregion #region Entities diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 5902080880..673674dc24 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -206,6 +206,43 @@ namespace OpenSim.Region.Framework.Scenes }); } + public void GetCoarseLocations(out List coarseLocations, out List avatarUUIDs, uint maxLocations) + { + coarseLocations = new List(); + avatarUUIDs = new List(); + + List presences = GetScenePresences(); + for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) + { + ScenePresence sp = presences[i]; + // If this presence is a child agent, we don't want its coarse locations + if (sp.IsChildAgent) + return; + + if (sp.ParentID != 0) + { + // sitting avatar + SceneObjectPart sop = m_parentScene.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); + } + } + else + { + coarseLocations.Add(sp.AbsolutePosition); + avatarUUIDs.Add(sp.UUID); + } + } + } + #endregion #region Entity Methods diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 45375b0e8c..15b9446c91 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes public ScriptControlled eventControls; } - public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence); + public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List coarseLocations, List avatarUUIDs); public class ScenePresence : EntityBase, ISceneEntity { @@ -173,8 +173,6 @@ namespace OpenSim.Region.Framework.Scenes public string JID = String.Empty; - // Agent moves with a PID controller causing a force to be exerted. - private bool m_newCoarseLocations = true; private float m_health = 100f; // Default AV Height @@ -2296,12 +2294,6 @@ namespace OpenSim.Region.Framework.Scenes SendPrimUpdates(); - if (m_newCoarseLocations) - { - SendCoarseLocations(); - m_newCoarseLocations = false; - } - if (m_isChildAgent == false) { // PhysicsActor actor = m_physicsActor; @@ -2375,12 +2367,12 @@ namespace OpenSim.Region.Framework.Scenes m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } - public void SendCoarseLocations() + public void SendCoarseLocations(List coarseLocations, List avatarUUIDs) { SendCourseLocationsMethod d = m_sendCourseLocationsMethod; if (d != null) { - d.Invoke(m_scene.RegionInfo.originRegionID, this); + d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); } } @@ -2390,50 +2382,13 @@ namespace OpenSim.Region.Framework.Scenes m_sendCourseLocationsMethod = d; } - public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) + public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List coarseLocations, List avatarUUIDs) { m_perfMonMS = Util.EnvironmentTickCount(); - - List CoarseLocations = new List(); - List AvatarUUIDs = new List(); - m_scene.ForEachScenePresence(delegate(ScenePresence sp) - { - if (sp.IsChildAgent) - return; - - if (sp.ParentID != 0) - { - // sitting avatar - SceneObjectPart sop = m_scene.GetSceneObjectPart(sp.ParentID); - if (sop != null) - { - CoarseLocations.Add(sop.AbsolutePosition + sp.m_pos); - AvatarUUIDs.Add(sp.UUID); - } - else - { - // we can't find the parent.. ! arg! - CoarseLocations.Add(sp.m_pos); - AvatarUUIDs.Add(sp.UUID); - } - } - else - { - CoarseLocations.Add(sp.m_pos); - AvatarUUIDs.Add(sp.UUID); - } - }); - - m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); - + m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } - public void CoarseLocationChange() - { - m_newCoarseLocations = true; - } - /// /// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar) /// @@ -2668,7 +2623,6 @@ namespace OpenSim.Region.Framework.Scenes { posLastSignificantMove = AbsolutePosition; m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient); - m_scene.NotifyMyCoarseLocationChange(); } // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 9cb349a1e9..ff0e743113 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -696,7 +696,9 @@ namespace OpenSim.Region.RegionCombinerModule presence.SetSendCourseLocationMethod(SendCourseLocationUpdates); } - private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence) + // This delegate was refactored for non-combined regions. + // This combined region version will not use the pre-compiled lists of locations and ids + private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence, List coarseLocations, List avatarUUIDs) { RegionConnections connectiondata = null; lock (m_regions)