From e14b7ec9e115dd1705d6952f5ecbb19806709944 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 30 May 2011 17:19:46 -0700 Subject: HGWorldMap: don't send map blocks of hyperlinks that are farther than 4096 cells from the current region. --- .../CoreModules/Hypergrid/HGWorldMapModule.cs | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index 5ab334f..0781de0 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Reflection; using log4net; @@ -58,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid #endregion - protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) + protected override List GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) { List mapBlocks = new List(); List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, @@ -67,9 +68,26 @@ namespace OpenSim.Region.CoreModules.Hypergrid foreach (GridRegion r in regions) { - MapBlockData block = new MapBlockData(); - MapBlockFromGridRegion(block, r); - mapBlocks.Add(block); + uint x = 0, y = 0; + long handle = 0; + if (r.RegionSecret != null && r.RegionSecret != string.Empty) + { + if (long.TryParse(r.RegionSecret, out handle)) + { + Utils.LongToUInts((ulong)handle, out x, out y); + x = x / Constants.RegionSize; + y = y / Constants.RegionSize; + } + } + + if (handle == 0 || + // Check the distance from the current region + (handle != 0 && Math.Abs((int)(x - m_scene.RegionInfo.RegionLocX)) < 4096 && Math.Abs((int)(y - m_scene.RegionInfo.RegionLocY)) < 4096)) + { + MapBlockData block = new MapBlockData(); + MapBlockFromGridRegion(block, r); + mapBlocks.Add(block); + } } // Different from super @@ -77,6 +95,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid // remoteClient.SendMapBlock(mapBlocks, 0); + + return mapBlocks; } -- cgit v1.1