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.

This commit is contained in:
Diva Canto
2011-06-10 09:16:43 -07:00
parent 8d3a8a0a81
commit 98d1e7768a
2 changed files with 59 additions and 33 deletions

View File

@@ -147,8 +147,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
base.AgentHasMovedAway(sp, logout);
if (logout)
{
// Reset the map
ResetMap(sp);
// Log them out of this grid
m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
}
}
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
}
protected void ResetMap(ScenePresence sp)
{
List<GridRegion> regions = m_Scenes[0].GridService.GetRegionRange(m_Scenes[0].RegionInfo.ScopeID, 0, 17000 * (int)Constants.RegionSize, 0, 17000 * (int)Constants.RegionSize);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Resetting {0} tiles on the map", regions.Count);
if (regions != null)
{
List<MapBlockData> mapBlocks = new List<MapBlockData>();
foreach (GridRegion r in regions)
{
MapBlockData mblock = new MapBlockData();
mblock.X = (ushort)(r.RegionLocX / Constants.RegionSize);
mblock.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
mblock.Name = "";
mblock.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's
mblock.MapImageId = UUID.Zero;
mapBlocks.Add(mblock);
}
sp.ControllingClient.SendMapBlock(mapBlocks, 0);
}
}
#endregion