minor cleanup

httptests
UbitUmarov 2018-06-16 14:11:44 +01:00
parent 76a82ba5de
commit ba193fc606
1 changed files with 12 additions and 36 deletions

View File

@ -1479,9 +1479,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Given a position relative to the current region and outside of it
// find the new region that the point is actually in.
// returns 'null' if new region not found or if information
// and new position relative to it
// find the new region that the point is actually in
// returns 'null' if new region not found or if agent as no access
// else also returns new target position in the new region local coords
// now only works for crossings
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
@ -1500,8 +1500,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Call the grid service to lookup the region containing the new position.
GridRegion neighbourRegion = GetRegionContainingWorldLocation(
scene.GridService, scene.RegionInfo.ScopeID,
presenceWorldX, presenceWorldY,
Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
presenceWorldX, presenceWorldY);
if (neighbourRegion == null)
return null;
@ -2277,68 +2276,46 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
{
// Since we don't know how big the regions could be, we have to search a very large area
// to find possible regions.
return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize);
}
// Given a world position, get the GridRegion info for
// the region containing that point.
// for compatibility with old grids it does a scan to find large regions
// 0.9 grids to that
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID,
double px, double py, uint pSizeHint)
{
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py);
GridRegion ret = null;
// check if we already found it does not exist
if (m_notFoundLocationCache.Contains(px, py))
{
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: Not found via cache. loc=<{1},{2}>", LogHeader, px, py);
return null;
}
// As an optimization, since most regions will be legacy sized regions (256x256), first try to get
// the region at the appropriate legacy region location.
// reduce to next grid corner
// this is all that is needed on 0.9 grids
uint possibleX = (uint)px & 0xffffff00u;
uint possibleY = (uint)py & 0xffffff00u;
ret = pGridService.GetRegionByPosition(pScopeID, (int)possibleX, (int)possibleY);
if (ret != null)
{
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: Found region using legacy size. rloc=<{1},{2}>. Rname={3}",
// LogHeader, possibleX, possibleY, ret.RegionName);
return ret;
}
// for 0.8 regions just make a BIG area request. old code whould do it plus 4 more smaller on region open edges
// this is what 0.9 grids now do internally
List<GridRegion> possibleRegions = pGridService.GetRegionRange(pScopeID,
(int)(px - Constants.MaximumRegionSize), (int)(px + 1), // +1 bc left mb not part of range
(int)(py - Constants.MaximumRegionSize), (int)(py + 1));
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: possibleRegions cnt={1}, range={2}",
// LogHeader, possibleRegions.Count, range);
if (possibleRegions != null && possibleRegions.Count > 0)
{
// If we found some regions, check to see if the point is within
foreach (GridRegion gr in possibleRegions)
{
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: possibleRegion nm={1}, regionLoc=<{2},{3}>, regionSize=<{4},{5}>",
// LogHeader, gr.RegionName, gr.RegionLocX, gr.RegionLocY, gr.RegionSizeX, gr.RegionSizeY);
if (px >= (double)gr.RegionLocX && px < (double)(gr.RegionLocX + gr.RegionSizeX)
&& py >= (double)gr.RegionLocY && py < (double)(gr.RegionLocY + gr.RegionSizeY))
{
// Found a region that contains the point
return gr;
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: found. RegionName={1}", LogHeader, ret.RegionName);
}
}
}
// remember this location was not found so we can quickly not find it next time
m_notFoundLocationCache.Add(px, py);
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: Not found. Remembering loc=<{1},{2}>", LogHeader, px, py);
return null;
}
@ -2362,7 +2339,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData agentCircData, GridRegion reg,
IPEndPoint endPoint, bool newAgent)
{
if (newAgent)
{
// we may already had lost this sp
@ -2435,7 +2411,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
uint dd = (uint)avatar.RegionViewDistance;
// until avatar movement updates client connections, we need to seend at least this current region imediate neighbors
// until avatar movement updates client connections, we need to send at least this current region immediate neighbors
uint ddX = Math.Max(dd, Constants.RegionSize);
uint ddY = Math.Max(dd, Constants.RegionSize);