diff options
author | Diva Canto | 2011-05-30 17:19:46 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-30 17:19:46 -0700 |
commit | e14b7ec9e115dd1705d6952f5ecbb19806709944 (patch) | |
tree | ee68f0422c3f1ff8ad85564e45783fa519a62f7c /OpenSim/Region/CoreModules | |
parent | Improved reuse on the WorldMap/WorldMapModule.cs (diff) | |
download | opensim-SC_OLD-e14b7ec9e115dd1705d6952f5ecbb19806709944.zip opensim-SC_OLD-e14b7ec9e115dd1705d6952f5ecbb19806709944.tar.gz opensim-SC_OLD-e14b7ec9e115dd1705d6952f5ecbb19806709944.tar.bz2 opensim-SC_OLD-e14b7ec9e115dd1705d6952f5ecbb19806709944.tar.xz |
HGWorldMap: don't send map blocks of hyperlinks that are farther than 4096 cells from the current region.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | 28 |
1 files changed, 24 insertions, 4 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 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using 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 | ||