Merge commit 'eac29396d98a4864923a69e0eb73cecdd8a225b3' into bigmerge

avinationmerge
Melanie 2011-10-25 03:17:11 +01:00
commit d1028b3647
5 changed files with 318 additions and 318 deletions

View File

@ -987,6 +987,46 @@ namespace OpenSim.Region.Framework.Scenes
return found;
}
/// <summary>
/// Checks whether this region has a neighbour in the given direction.
/// </summary>
/// <param name="car"></param>
/// <param name="fix"></param>
/// <returns>
/// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
/// Returns a positive integer if there is a region in that direction, a negative integer if not.
/// </returns>
public int HaveNeighbor(Cardinals car, ref int[] fix)
{
uint neighbourx = RegionInfo.RegionLocX;
uint neighboury = RegionInfo.RegionLocY;
int dir = (int)car;
if (dir > 1 && dir < 5) //Heading East
neighbourx++;
else if (dir > 5) // Heading West
neighbourx--;
if (dir < 3 || dir == 8) // Heading North
neighboury++;
else if (dir > 3 && dir < 7) // Heading Sout
neighboury--;
int x = (int)(neighbourx * Constants.RegionSize);
int y = (int)(neighboury * Constants.RegionSize);
GridRegion neighbourRegion = GridService.GetRegionByPosition(RegionInfo.ScopeID, x, y);
if (neighbourRegion == null)
{
fix[0] = (int)(RegionInfo.RegionLocX - neighbourx);
fix[1] = (int)(RegionInfo.RegionLocY - neighboury);
return dir * (-1);
}
else
return dir;
}
// Alias IncomingHelloNeighbour OtherRegionUp, for now
public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
{

View File

@ -3134,17 +3134,17 @@ namespace OpenSim.Region.Framework.Scenes
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.SW, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.NW, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
}
else
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.W, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.E))
@ -3152,28 +3152,28 @@ namespace OpenSim.Region.Framework.Scenes
if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.SE, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.NE, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
}
else
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.E, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
}
}
else if (m_scene.TestBorderCross(pos2, Cardinals.S))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.S, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
}
else if (m_scene.TestBorderCross(pos2, Cardinals.N))
{
needsTransit = true;
neighbor = HaveNeighbor(Cardinals.N, ref fix);
neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
}
// Makes sure avatar does not end up outside region
@ -3248,46 +3248,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Checks whether this region has a neighbour in the given direction.
/// </summary>
/// <param name="car"></param>
/// <param name="fix"></param>
/// <returns>
/// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
/// Returns a positive integer if there is a region in that direction, a negative integer if not.
/// </returns>
protected int HaveNeighbor(Cardinals car, ref int[] fix)
{
uint neighbourx = m_scene.RegionInfo.RegionLocX;
uint neighboury = m_scene.RegionInfo.RegionLocY;
int dir = (int)car;
if (dir > 1 && dir < 5) //Heading East
neighbourx++;
else if (dir > 5) // Heading West
neighbourx--;
if (dir < 3 || dir == 8) // Heading North
neighboury++;
else if (dir > 3 && dir < 7) // Heading Sout
neighboury--;
int x = (int)(neighbourx * Constants.RegionSize);
int y = (int)(neighboury * Constants.RegionSize);
GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
if (neighbourRegion == null)
{
fix[0] = (int)(m_scene.RegionInfo.RegionLocX - neighbourx);
fix[1] = (int)(m_scene.RegionInfo.RegionLocY - neighboury);
return dir * (-1);
}
else
return dir;
}
/// <summary>
/// Moves the agent outside the region bounds
/// Tells neighbor region that we're crossing to it