Improved reuse on the WorldMap/WorldMapModule.cs

0.7.1-dev
Diva Canto 2011-05-30 17:15:55 -07:00
parent 33831f74b9
commit e5eb4c47e0
1 changed files with 5 additions and 15 deletions

View File

@ -233,20 +233,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
} }
if (lookup) if (lookup)
{ {
List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; List<MapBlockData> mapBlocks = GetAndSendBlocks(avatarPresence.ControllingClient, (int)(m_scene.RegionInfo.RegionLocX) - 4, (int)(m_scene.RegionInfo.RegionLocY) - 4,
(int)(m_scene.RegionInfo.RegionLocX) + 4, (int)(m_scene.RegionInfo.RegionLocY) + 4, 0);
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
(int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize,
(int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize,
(int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize,
(int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize);
foreach (GridRegion r in regions)
{
MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, r);
mapBlocks.Add(block);
}
avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
lock (cachedMapBlocks) lock (cachedMapBlocks)
cachedMapBlocks = mapBlocks; cachedMapBlocks = mapBlocks;
@ -832,7 +820,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
} }
} }
protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) protected virtual List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
{ {
List<MapBlockData> mapBlocks = new List<MapBlockData>(); List<MapBlockData> mapBlocks = new List<MapBlockData>();
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
@ -847,6 +835,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
mapBlocks.Add(block); mapBlocks.Add(block);
} }
remoteClient.SendMapBlock(mapBlocks, 0); remoteClient.SendMapBlock(mapBlocks, 0);
return mapBlocks;
} }
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r)