mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Rewrite of mega-region code to use new form of border checking.
This commit eliminates all of the 'border' class and list code and replaces it with testing if in the current region. Impacts: can make a mega-region out of varregions of the same size; and mega-region combinations must be rectangular (not square but rectangular)
This commit is contained in:
@@ -464,7 +464,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
sp.Name, position, sp.Scene.RegionInfo.RegionName);
|
||||
|
||||
// Teleport within the same region
|
||||
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
|
||||
if (!sp.Scene.PositionIsInCurrentRegion(position) || position.Z < 0)
|
||||
{
|
||||
Vector3 emergencyPos = new Vector3(128, 128, 128);
|
||||
|
||||
@@ -580,7 +580,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
MapBlockData block = new MapBlockData();
|
||||
block.X = (ushort)regX;
|
||||
block.Y = (ushort)regY;
|
||||
block.Access = 254; // == not there
|
||||
block.Access = (byte)SimAccess.Down;
|
||||
|
||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||
blocks.Add(block);
|
||||
@@ -713,10 +713,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return;
|
||||
}
|
||||
|
||||
uint newRegionX = (uint)(reg.RegionHandle >> 40);
|
||||
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
|
||||
uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40);
|
||||
uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8);
|
||||
uint newRegionX, newRegionY, oldRegionX, oldRegionY;
|
||||
Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY);
|
||||
Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY);
|
||||
|
||||
ulong destinationHandle = finalDestination.RegionHandle;
|
||||
|
||||
@@ -1333,6 +1332,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return region;
|
||||
}
|
||||
|
||||
// This returns 'true' if the new region already has a child agent for our
|
||||
// incoming agent. The implication is that, if 'false', we have to create the
|
||||
// child and then teleport into the region.
|
||||
protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
|
||||
{
|
||||
if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
|
||||
@@ -1357,20 +1359,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY);
|
||||
}
|
||||
|
||||
protected virtual bool IsOutsideRegion(Scene s, Vector3 pos)
|
||||
{
|
||||
if (s.TestBorderCross(pos, Cardinals.N))
|
||||
return true;
|
||||
if (s.TestBorderCross(pos, Cardinals.S))
|
||||
return true;
|
||||
if (s.TestBorderCross(pos, Cardinals.E))
|
||||
return true;
|
||||
if (s.TestBorderCross(pos, Cardinals.W))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Landmark Teleport
|
||||
@@ -2077,7 +2065,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
public NotFoundLocationCache()
|
||||
{
|
||||
}
|
||||
// Add an area to the lost of 'not found' places. The area is the snapped region
|
||||
// Add an area to the list of 'not found' places. The area is the snapped region
|
||||
// area around the added point.
|
||||
public void Add(double pX, double pY)
|
||||
{
|
||||
@@ -2305,22 +2293,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
/// <param name='neCorner'></param>
|
||||
private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner)
|
||||
{
|
||||
Border[] northBorders = Scene.NorthBorders.ToArray();
|
||||
Border[] eastBorders = Scene.EastBorders.ToArray();
|
||||
|
||||
Vector2 extent = Vector2.Zero;
|
||||
for (int i = 0; i < eastBorders.Length; i++)
|
||||
{
|
||||
extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
|
||||
}
|
||||
for (int i = 0; i < northBorders.Length; i++)
|
||||
{
|
||||
extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
|
||||
}
|
||||
|
||||
// Loss of fraction on purpose
|
||||
extent.X = ((int)extent.X / (int)Constants.RegionSize);
|
||||
extent.Y = ((int)extent.Y / (int)Constants.RegionSize);
|
||||
if (m_regionCombinerModule != null)
|
||||
{
|
||||
Vector2 megaRegionSize = m_regionCombinerModule.GetSizeOfMegaregion(Scene.RegionInfo.RegionID);
|
||||
extent.X = (float)Util.WorldToRegionLoc((uint)megaRegionSize.X);
|
||||
extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y);
|
||||
}
|
||||
|
||||
swCorner.X = Scene.RegionInfo.RegionLocX - 1;
|
||||
swCorner.Y = Scene.RegionInfo.RegionLocY - 1;
|
||||
|
||||
Reference in New Issue
Block a user