* Fixes diagonal teleporting when in RegionCombining mode by adding 4 additional borders that have infinite distances perpendicular to the cardinal of the border surrounding the entire combined region. Recalculates this boundary each time AddScene is called.

remotes/origin/0.6.7-post-fixes
Teravus Ovares (Dan Olivares) 2009-09-01 19:38:45 -04:00
parent 2245e2977e
commit afc72cc10e
1 changed files with 50 additions and 11 deletions

View File

@ -475,6 +475,7 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
AdjustLargeRegionBounds();
} }
@ -495,7 +496,7 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
// Create a set of infinite borders around the whole aabb of the combined island. // Create a set of infinite borders around the whole aabb of the combined island.
private void MakeLargeRegionBounds() private void AdjustLargeRegionBounds()
{ {
lock (m_regions) lock (m_regions)
{ {
@ -512,36 +513,60 @@ namespace OpenSim.Region.CoreModules.World.Land
lock (rconn.RegionScene.NorthBorders) lock (rconn.RegionScene.NorthBorders)
{ {
Border northBorder = new Border();
Border northBorder = null;
if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
{
northBorder = new Border();
rconn.RegionScene.NorthBorders.Add(northBorder);
}
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
offset.Y); //<--- offset.Y + (int) Constants.RegionSize); //<---
northBorder.CrossDirection = Cardinals.N; northBorder.CrossDirection = Cardinals.N;
rconn.RegionScene.NorthBorders.Add(northBorder);
} }
lock (rconn.RegionScene.SouthBorders) lock (rconn.RegionScene.SouthBorders)
{ {
Border southBorder = new Border(); Border southBorder = null;
if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
{
southBorder = new Border();
rconn.RegionScene.SouthBorders.Add(southBorder);
}
southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
southBorder.CrossDirection = Cardinals.S; southBorder.CrossDirection = Cardinals.S;
rconn.RegionScene.SouthBorders.Add(southBorder);
} }
lock (rconn.RegionScene.EastBorders) lock (rconn.RegionScene.EastBorders)
{ {
Border eastBorder = new Border(); Border eastBorder = null;
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.Y); if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
{
eastBorder = new Border();
rconn.RegionScene.EastBorders.Add(eastBorder);
}
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
//<--- //<---
eastBorder.CrossDirection = Cardinals.E; eastBorder.CrossDirection = Cardinals.E;
rconn.RegionScene.EastBorders.Add(eastBorder);
} }
lock (rconn.RegionScene.WestBorders) lock (rconn.RegionScene.WestBorders)
{ {
Border westBorder = new Border(); Border westBorder = null;
if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
{
westBorder = new Border();
rconn.RegionScene.WestBorders.Add(westBorder);
}
westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
westBorder.CrossDirection = Cardinals.W; westBorder.CrossDirection = Cardinals.W;
rconn.RegionScene.WestBorders.Add(westBorder);
} }
@ -551,6 +576,20 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
{
// Warning! Should be locked before getting here!
foreach (Border b in borders)
{
if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
{
oborder = b;
return true;
}
}
oborder = null;
return false;
}
public RegionData GetRegionFromPosition(Vector3 pPosition) public RegionData GetRegionFromPosition(Vector3 pPosition)
{ {