diff options
author | Diva Canto | 2011-06-08 16:38:25 -0700 |
---|---|---|
committer | Diva Canto | 2011-06-08 16:38:25 -0700 |
commit | 2a46f756d673f4caa2049f2ddda219fdba810eed (patch) | |
tree | bc31e0731e81821f1bb1e12bd8b46b3fd85a35ae | |
parent | Reverting the [HG]MapModule to its buggy behavior above 4096. Ppl seem to pre... (diff) | |
download | opensim-SC_OLD-2a46f756d673f4caa2049f2ddda219fdba810eed.zip opensim-SC_OLD-2a46f756d673f4caa2049f2ddda219fdba810eed.tar.gz opensim-SC_OLD-2a46f756d673f4caa2049f2ddda219fdba810eed.tar.bz2 opensim-SC_OLD-2a46f756d673f4caa2049f2ddda219fdba810eed.tar.xz |
Fixed a compilation problem. Also added a lengthy comment on the Map hack, so that it never goes unnoticed again.
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 83 |
2 files changed, 49 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index 0781de0..f066f83 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
59 | 59 | ||
60 | #endregion | 60 | #endregion |
61 | 61 | ||
62 | protected override List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 62 | protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
63 | { | 63 | { |
64 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | 64 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
65 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 65 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
@@ -96,7 +96,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
96 | 96 | ||
97 | remoteClient.SendMapBlock(mapBlocks, 0); | 97 | remoteClient.SendMapBlock(mapBlocks, 0); |
98 | 98 | ||
99 | return mapBlocks; | ||
100 | } | 99 | } |
101 | 100 | ||
102 | 101 | ||
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 0cacf2d..ed3677b 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -208,52 +208,65 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
208 | //m_log.DebugFormat("[MAPLAYER]: path: {0}, param: {1}, agent:{2}", | 208 | //m_log.DebugFormat("[MAPLAYER]: path: {0}, param: {1}, agent:{2}", |
209 | // path, param, agentID.ToString()); | 209 | // path, param, agentID.ToString()); |
210 | 210 | ||
211 | // this is here because CAPS map requests work even beyond the 10,000 limit. | 211 | // There is a major hack going on in this method. The viewer doesn't request |
212 | ScenePresence avatarPresence = null; | 212 | // map blocks (RequestMapBlocks) above 4096. That means that if we don't hack, |
213 | 213 | // grids above that cell don't have a map at all. So, here's the hack: we wait | |
214 | m_scene.TryGetScenePresence(agentID, out avatarPresence); | 214 | // for this CAP request to come, and we inject the map blocks at this point. |
215 | 215 | // In a normal scenario, this request simply sends back the MapLayer (the blue color). | |
216 | if (avatarPresence != null) | 216 | // In the hacked scenario, it also sends the map blocks via UDP. |
217 | // | ||
218 | // 6/8/2011 -- I'm adding an explicit 4096 check, so that we never forget that there is | ||
219 | // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. | ||
220 | |||
221 | if (m_scene.RegionInfo.RegionLocX >= 4096 || m_scene.RegionInfo.RegionLocY > 4096) | ||
217 | { | 222 | { |
218 | bool lookup = false; | 223 | ScenePresence avatarPresence = null; |
219 | 224 | ||
220 | lock (cachedMapBlocks) | 225 | m_scene.TryGetScenePresence(agentID, out avatarPresence); |
221 | { | ||
222 | if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch())) | ||
223 | { | ||
224 | List<MapBlockData> mapBlocks; | ||
225 | 226 | ||
226 | mapBlocks = cachedMapBlocks; | 227 | if (avatarPresence != null) |
227 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
228 | } | ||
229 | else | ||
230 | { | ||
231 | lookup = true; | ||
232 | } | ||
233 | } | ||
234 | if (lookup) | ||
235 | { | 228 | { |
236 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; | 229 | bool lookup = false; |
237 | 230 | ||
238 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 231 | lock (cachedMapBlocks) |
239 | (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, | ||
240 | (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, | ||
241 | (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, | ||
242 | (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); | ||
243 | foreach (GridRegion r in regions) | ||
244 | { | 232 | { |
245 | MapBlockData block = new MapBlockData(); | 233 | if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch())) |
246 | MapBlockFromGridRegion(block, r); | 234 | { |
247 | mapBlocks.Add(block); | 235 | List<MapBlockData> mapBlocks; |
236 | |||
237 | mapBlocks = cachedMapBlocks; | ||
238 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
239 | } | ||
240 | else | ||
241 | { | ||
242 | lookup = true; | ||
243 | } | ||
248 | } | 244 | } |
249 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | 245 | if (lookup) |
246 | { | ||
247 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; | ||
248 | |||
249 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | ||
250 | (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, | ||
251 | (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, | ||
252 | (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, | ||
253 | (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); | ||
254 | foreach (GridRegion r in regions) | ||
255 | { | ||
256 | MapBlockData block = new MapBlockData(); | ||
257 | MapBlockFromGridRegion(block, r); | ||
258 | mapBlocks.Add(block); | ||
259 | } | ||
260 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
250 | 261 | ||
251 | lock (cachedMapBlocks) | 262 | lock (cachedMapBlocks) |
252 | cachedMapBlocks = mapBlocks; | 263 | cachedMapBlocks = mapBlocks; |
253 | 264 | ||
254 | cachedTime = Util.UnixTimeSinceEpoch(); | 265 | cachedTime = Util.UnixTimeSinceEpoch(); |
266 | } | ||
255 | } | 267 | } |
256 | } | 268 | } |
269 | |||
257 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | 270 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); |
258 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); | 271 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); |
259 | return mapResponse.ToString(); | 272 | return mapResponse.ToString(); |