aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2011-05-30 17:19:46 -0700
committerDiva Canto2011-05-30 17:19:46 -0700
commite14b7ec9e115dd1705d6952f5ecbb19806709944 (patch)
treeee68f0422c3f1ff8ad85564e45783fa519a62f7c /OpenSim
parentImproved reuse on the WorldMap/WorldMapModule.cs (diff)
downloadopensim-SC-e14b7ec9e115dd1705d6952f5ecbb19806709944.zip
opensim-SC-e14b7ec9e115dd1705d6952f5ecbb19806709944.tar.gz
opensim-SC-e14b7ec9e115dd1705d6952f5ecbb19806709944.tar.bz2
opensim-SC-e14b7ec9e115dd1705d6952f5ecbb19806709944.tar.xz
HGWorldMap: don't send map blocks of hyperlinks that are farther than 4096 cells from the current region.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs28
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs5
2 files changed, 28 insertions, 5 deletions
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 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
@@ -58,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
58 59
59 #endregion 60 #endregion
60 61
61 protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 62 protected override List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
62 { 63 {
63 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 64 List<MapBlockData> mapBlocks = new List<MapBlockData>();
64 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 65 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
@@ -67,9 +68,26 @@ namespace OpenSim.Region.CoreModules.Hypergrid
67 68
68 foreach (GridRegion r in regions) 69 foreach (GridRegion r in regions)
69 { 70 {
70 MapBlockData block = new MapBlockData(); 71 uint x = 0, y = 0;
71 MapBlockFromGridRegion(block, r); 72 long handle = 0;
72 mapBlocks.Add(block); 73 if (r.RegionSecret != null && r.RegionSecret != string.Empty)
74 {
75 if (long.TryParse(r.RegionSecret, out handle))
76 {
77 Utils.LongToUInts((ulong)handle, out x, out y);
78 x = x / Constants.RegionSize;
79 y = y / Constants.RegionSize;
80 }
81 }
82
83 if (handle == 0 ||
84 // Check the distance from the current region
85 (handle != 0 && Math.Abs((int)(x - m_scene.RegionInfo.RegionLocX)) < 4096 && Math.Abs((int)(y - m_scene.RegionInfo.RegionLocY)) < 4096))
86 {
87 MapBlockData block = new MapBlockData();
88 MapBlockFromGridRegion(block, r);
89 mapBlocks.Add(block);
90 }
73 } 91 }
74 92
75 // Different from super 93 // Different from super
@@ -77,6 +95,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
77 // 95 //
78 96
79 remoteClient.SendMapBlock(mapBlocks, 0); 97 remoteClient.SendMapBlock(mapBlocks, 0);
98
99 return mapBlocks;
80 } 100 }
81 101
82 102
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index c539047..b7c0e91 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -363,11 +363,14 @@ namespace OpenSim.Services.GridService
363 else 363 else
364 regInfo.RegionName = externalName; 364 regInfo.RegionName = externalName;
365 365
366 m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); 366 m_log.DebugFormat("[HYPERGRID LINKER]: naming linked region {0}, handle {1}", regInfo.RegionName, handle.ToString());
367 367
368 // Get the map image 368 // Get the map image
369 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); 369 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory);
370 370
371 // Store the origin's coordinates somewhere
372 regInfo.RegionSecret = handle.ToString();
373
371 AddHyperlinkRegion(regInfo, handle); 374 AddHyperlinkRegion(regInfo, handle);
372 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 375 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage);
373 return true; 376 return true;