diff options
author | Diva Canto | 2011-06-10 09:16:43 -0700 |
---|---|---|
committer | Diva Canto | 2011-06-10 09:16:43 -0700 |
commit | 98d1e7768af945d3516243f3e010cc4e1fc0788a (patch) | |
tree | 0c05c04b568995c0154aec90335d40d680950843 | |
parent | The map breakage is actually at 2048! (diff) | |
download | opensim-SC-98d1e7768af945d3516243f3e010cc4e1fc0788a.zip opensim-SC-98d1e7768af945d3516243f3e010cc4e1fc0788a.tar.gz opensim-SC-98d1e7768af945d3516243f3e010cc4e1fc0788a.tar.bz2 opensim-SC-98d1e7768af945d3516243f3e010cc4e1fc0788a.tar.xz |
New method for resetting the map on HG: do it only once upon changing grids, and reset only exactly the map blocks that had regions in them. WARNING: this fetches all the regions from the Grid service, so there is a chance that this is a really bad idea in large grids. Pushing it for testing.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | 66 |
2 files changed, 59 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 37d81a3..8df89ad 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -147,8 +147,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
147 | { | 147 | { |
148 | base.AgentHasMovedAway(sp, logout); | 148 | base.AgentHasMovedAway(sp, logout); |
149 | if (logout) | 149 | if (logout) |
150 | { | ||
151 | // Reset the map | ||
152 | ResetMap(sp); | ||
153 | |||
150 | // Log them out of this grid | 154 | // Log them out of this grid |
151 | m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 155 | m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
156 | } | ||
152 | } | 157 | } |
153 | 158 | ||
154 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 159 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |
@@ -280,6 +285,27 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
280 | 285 | ||
281 | } | 286 | } |
282 | 287 | ||
288 | protected void ResetMap(ScenePresence sp) | ||
289 | { | ||
290 | List<GridRegion> regions = m_Scenes[0].GridService.GetRegionRange(m_Scenes[0].RegionInfo.ScopeID, 0, 17000 * (int)Constants.RegionSize, 0, 17000 * (int)Constants.RegionSize); | ||
291 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Resetting {0} tiles on the map", regions.Count); | ||
292 | if (regions != null) | ||
293 | { | ||
294 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | ||
295 | foreach (GridRegion r in regions) | ||
296 | { | ||
297 | MapBlockData mblock = new MapBlockData(); | ||
298 | mblock.X = (ushort)(r.RegionLocX / Constants.RegionSize); | ||
299 | mblock.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | ||
300 | mblock.Name = ""; | ||
301 | mblock.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's | ||
302 | mblock.MapImageId = UUID.Zero; | ||
303 | mapBlocks.Add(mblock); | ||
304 | } | ||
305 | sp.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
306 | } | ||
307 | |||
308 | } | ||
283 | 309 | ||
284 | #endregion | 310 | #endregion |
285 | 311 | ||
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index f066f83..fd2cc20 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | |||
@@ -59,44 +59,44 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
59 | 59 | ||
60 | #endregion | 60 | #endregion |
61 | 61 | ||
62 | protected override void 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, |
66 | minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize, | 66 | // minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize, |
67 | minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); | 67 | // minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); |
68 | 68 | ||
69 | foreach (GridRegion r in regions) | 69 | // foreach (GridRegion r in regions) |
70 | { | 70 | // { |
71 | uint x = 0, y = 0; | 71 | // uint x = 0, y = 0; |
72 | long handle = 0; | 72 | // long handle = 0; |
73 | if (r.RegionSecret != null && r.RegionSecret != string.Empty) | 73 | // if (r.RegionSecret != null && r.RegionSecret != string.Empty) |
74 | { | 74 | // { |
75 | if (long.TryParse(r.RegionSecret, out handle)) | 75 | // if (long.TryParse(r.RegionSecret, out handle)) |
76 | { | 76 | // { |
77 | Utils.LongToUInts((ulong)handle, out x, out y); | 77 | // Utils.LongToUInts((ulong)handle, out x, out y); |
78 | x = x / Constants.RegionSize; | 78 | // x = x / Constants.RegionSize; |
79 | y = y / Constants.RegionSize; | 79 | // y = y / Constants.RegionSize; |
80 | } | 80 | // } |
81 | } | 81 | // } |
82 | 82 | ||
83 | if (handle == 0 || | 83 | // if (handle == 0 || |
84 | // Check the distance from the current region | 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)) | 85 | // (handle != 0 && Math.Abs((int)(x - m_scene.RegionInfo.RegionLocX)) < 4096 && Math.Abs((int)(y - m_scene.RegionInfo.RegionLocY)) < 4096)) |
86 | { | 86 | // { |
87 | MapBlockData block = new MapBlockData(); | 87 | // MapBlockData block = new MapBlockData(); |
88 | MapBlockFromGridRegion(block, r); | 88 | // MapBlockFromGridRegion(block, r); |
89 | mapBlocks.Add(block); | 89 | // mapBlocks.Add(block); |
90 | } | 90 | // } |
91 | } | 91 | // } |
92 | 92 | ||
93 | // Different from super | 93 | // // Different from super |
94 | FillInMap(mapBlocks, minX, minY, maxX, maxY); | 94 | // //FillInMap(mapBlocks, minX, minY, maxX, maxY); |
95 | // | 95 | // // |
96 | 96 | ||
97 | remoteClient.SendMapBlock(mapBlocks, 0); | 97 | // remoteClient.SendMapBlock(mapBlocks, 0); |
98 | 98 | ||
99 | } | 99 | //} |
100 | 100 | ||
101 | 101 | ||
102 | private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) | 102 | private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) |