minor cleanup
parent
76a82ba5de
commit
ba193fc606
|
@ -1479,9 +1479,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
|
|
||||||
// Given a position relative to the current region and outside of it
|
// Given a position relative to the current region and outside of it
|
||||||
// find the new region that the point is actually in.
|
// find the new region that the point is actually in
|
||||||
// returns 'null' if new region not found or if information
|
// returns 'null' if new region not found or if agent as no access
|
||||||
// and new position relative to it
|
// else also returns new target position in the new region local coords
|
||||||
// now only works for crossings
|
// now only works for crossings
|
||||||
|
|
||||||
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
|
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.
|
// Call the grid service to lookup the region containing the new position.
|
||||||
GridRegion neighbourRegion = GetRegionContainingWorldLocation(
|
GridRegion neighbourRegion = GetRegionContainingWorldLocation(
|
||||||
scene.GridService, scene.RegionInfo.ScopeID,
|
scene.GridService, scene.RegionInfo.ScopeID,
|
||||||
presenceWorldX, presenceWorldY,
|
presenceWorldX, presenceWorldY);
|
||||||
Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
|
|
||||||
|
|
||||||
if (neighbourRegion == null)
|
if (neighbourRegion == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -2277,68 +2276,46 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
|
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
|
// Given a world position, get the GridRegion info for
|
||||||
// the region containing that point.
|
// the region containing that point.
|
||||||
// for compatibility with old grids it does a scan to find large regions
|
// for compatibility with old grids it does a scan to find large regions
|
||||||
// 0.9 grids to that
|
// 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);
|
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py);
|
||||||
GridRegion ret = null;
|
GridRegion ret = null;
|
||||||
|
|
||||||
|
// check if we already found it does not exist
|
||||||
if (m_notFoundLocationCache.Contains(px, py))
|
if (m_notFoundLocationCache.Contains(px, py))
|
||||||
{
|
|
||||||
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: Not found via cache. loc=<{1},{2}>", LogHeader, px, py);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
// As an optimization, since most regions will be legacy sized regions (256x256), first try to get
|
// reduce to next grid corner
|
||||||
// the region at the appropriate legacy region location.
|
|
||||||
// this is all that is needed on 0.9 grids
|
// this is all that is needed on 0.9 grids
|
||||||
uint possibleX = (uint)px & 0xffffff00u;
|
uint possibleX = (uint)px & 0xffffff00u;
|
||||||
uint possibleY = (uint)py & 0xffffff00u;
|
uint possibleY = (uint)py & 0xffffff00u;
|
||||||
ret = pGridService.GetRegionByPosition(pScopeID, (int)possibleX, (int)possibleY);
|
ret = pGridService.GetRegionByPosition(pScopeID, (int)possibleX, (int)possibleY);
|
||||||
if (ret != null)
|
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;
|
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
|
// 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
|
// this is what 0.9 grids now do internally
|
||||||
List<GridRegion> possibleRegions = pGridService.GetRegionRange(pScopeID,
|
List<GridRegion> possibleRegions = pGridService.GetRegionRange(pScopeID,
|
||||||
(int)(px - Constants.MaximumRegionSize), (int)(px + 1), // +1 bc left mb not part of range
|
(int)(px - Constants.MaximumRegionSize), (int)(px + 1), // +1 bc left mb not part of range
|
||||||
(int)(py - Constants.MaximumRegionSize), (int)(py + 1));
|
(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 (possibleRegions != null && possibleRegions.Count > 0)
|
||||||
{
|
{
|
||||||
// If we found some regions, check to see if the point is within
|
// If we found some regions, check to see if the point is within
|
||||||
foreach (GridRegion gr in possibleRegions)
|
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)
|
if (px >= (double)gr.RegionLocX && px < (double)(gr.RegionLocX + gr.RegionSizeX)
|
||||||
&& py >= (double)gr.RegionLocY && py < (double)(gr.RegionLocY + gr.RegionSizeY))
|
&& py >= (double)gr.RegionLocY && py < (double)(gr.RegionLocY + gr.RegionSizeY))
|
||||||
{
|
{
|
||||||
// Found a region that contains the point
|
// Found a region that contains the point
|
||||||
return gr;
|
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
|
// remember this location was not found so we can quickly not find it next time
|
||||||
m_notFoundLocationCache.Add(px, py);
|
m_notFoundLocationCache.Add(px, py);
|
||||||
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: Not found. Remembering loc=<{1},{2}>", LogHeader, px, py);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2362,7 +2339,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData agentCircData, GridRegion reg,
|
private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData agentCircData, GridRegion reg,
|
||||||
IPEndPoint endPoint, bool newAgent)
|
IPEndPoint endPoint, bool newAgent)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (newAgent)
|
if (newAgent)
|
||||||
{
|
{
|
||||||
// we may already had lost this sp
|
// we may already had lost this sp
|
||||||
|
@ -2435,7 +2411,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
uint dd = (uint)avatar.RegionViewDistance;
|
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 ddX = Math.Max(dd, Constants.RegionSize);
|
||||||
uint ddY = Math.Max(dd, Constants.RegionSize);
|
uint ddY = Math.Max(dd, Constants.RegionSize);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue