mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 22:26:09 +08:00
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:
@@ -59,44 +59,44 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
|
||||
{
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize,
|
||||
minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize);
|
||||
//protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
|
||||
//{
|
||||
// List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
// List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
// minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize,
|
||||
// minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize);
|
||||
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
uint x = 0, y = 0;
|
||||
long handle = 0;
|
||||
if (r.RegionSecret != null && r.RegionSecret != string.Empty)
|
||||
{
|
||||
if (long.TryParse(r.RegionSecret, out handle))
|
||||
{
|
||||
Utils.LongToUInts((ulong)handle, out x, out y);
|
||||
x = x / Constants.RegionSize;
|
||||
y = y / Constants.RegionSize;
|
||||
}
|
||||
}
|
||||
// foreach (GridRegion r in regions)
|
||||
// {
|
||||
// uint x = 0, y = 0;
|
||||
// long handle = 0;
|
||||
// if (r.RegionSecret != null && r.RegionSecret != string.Empty)
|
||||
// {
|
||||
// if (long.TryParse(r.RegionSecret, out handle))
|
||||
// {
|
||||
// Utils.LongToUInts((ulong)handle, out x, out y);
|
||||
// x = x / Constants.RegionSize;
|
||||
// y = y / Constants.RegionSize;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (handle == 0 ||
|
||||
// Check the distance from the current region
|
||||
(handle != 0 && Math.Abs((int)(x - m_scene.RegionInfo.RegionLocX)) < 4096 && Math.Abs((int)(y - m_scene.RegionInfo.RegionLocY)) < 4096))
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
}
|
||||
// if (handle == 0 ||
|
||||
// // Check the distance from the current region
|
||||
// (handle != 0 && Math.Abs((int)(x - m_scene.RegionInfo.RegionLocX)) < 4096 && Math.Abs((int)(y - m_scene.RegionInfo.RegionLocY)) < 4096))
|
||||
// {
|
||||
// MapBlockData block = new MapBlockData();
|
||||
// MapBlockFromGridRegion(block, r);
|
||||
// mapBlocks.Add(block);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Different from super
|
||||
FillInMap(mapBlocks, minX, minY, maxX, maxY);
|
||||
//
|
||||
// // Different from super
|
||||
// //FillInMap(mapBlocks, minX, minY, maxX, maxY);
|
||||
// //
|
||||
|
||||
remoteClient.SendMapBlock(mapBlocks, 0);
|
||||
// remoteClient.SendMapBlock(mapBlocks, 0);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY)
|
||||
|
||||
Reference in New Issue
Block a user