* Fixes some prim crossings on megaregions with regions beyond the 512m mark

* There's a slight chance that this could cause a problem with regular prim crossings..   but hopefully not.     Revert if it does.
prioritization
Teravus Ovares (Dan Olivares) 2009-10-13 22:03:00 -04:00
parent e3d5beebfb
commit 31a61bbeec
2 changed files with 99 additions and 25 deletions

View File

@ -343,7 +343,9 @@ namespace OpenSim.Region.CoreModules.World.Land
lock (scene.WestBorders)
{
scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
// Trigger auto teleport to root region
scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
@ -410,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.Land
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
lock (scene.SouthBorders)
{
scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
}
@ -481,7 +483,7 @@ namespace OpenSim.Region.CoreModules.World.Land
lock (scene.SouthBorders)
{
scene.SouthBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport south
scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
}
@ -503,7 +505,7 @@ namespace OpenSim.Region.CoreModules.World.Land
lock (scene.WestBorders)
{
scene.WestBorders[0].BorderLine.Z += (int) Constants.RegionSize; //auto teleport West
scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
}

View File

@ -1780,36 +1780,86 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = attemptedPosition;
int changeX = 1;
int changeY = 1;
if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
{
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
{
//Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
//Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
if (crossedBorderx.BorderLine.Z > 0)
{
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize);
}
else
pos.X = ((pos.X + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
pos.X = ((pos.X + Constants.RegionSize));
pos.Y = ((pos.Y + Constants.RegionSize));
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
(uint)((thisy - 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint)((thisy - changeY) * Constants.RegionSize));
// x - 1
// y - 1
}
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
{
pos.X = ((pos.X + Constants.RegionSize));
pos.Y = ((pos.Y - Constants.RegionSize));
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
if (crossedBorderx.BorderLine.Z > 0)
{
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.X = ((pos.X + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
(uint)((thisy + 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint)((thisy + changeY) * Constants.RegionSize));
// x - 1
// y + 1
}
else
{
pos.X = ((pos.X + Constants.RegionSize));
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
if (crossedBorderx.BorderLine.Z > 0)
{
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.X = ((pos.X + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint) ((thisx - 1)*Constants.RegionSize),
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
(uint) (thisy*Constants.RegionSize));
// x - 1
}
@ -1818,11 +1868,23 @@ namespace OpenSim.Region.Framework.Scenes
{
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
{
pos.X = ((pos.X - Constants.RegionSize));
pos.Y = ((pos.Y + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
(uint)((thisy - 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
(uint)((thisy - changeY) * Constants.RegionSize));
// x + 1
// y - 1
}
@ -1831,8 +1893,8 @@ namespace OpenSim.Region.Framework.Scenes
pos.X = ((pos.X - Constants.RegionSize));
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
(uint)((thisy + 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
(uint)((thisy + changeY) * Constants.RegionSize));
// x + 1
// y + 1
}
@ -1840,16 +1902,26 @@ namespace OpenSim.Region.Framework.Scenes
{
pos.X = ((pos.X - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint) ((thisx + 1)*Constants.RegionSize),
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
(uint) (thisy*Constants.RegionSize));
// x + 1
}
}
else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
{
pos.Y = ((pos.Y + Constants.RegionSize));
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
if (crossedBordery.BorderLine.Z > 0)
{
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
}
else
pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize));
// y - 1
}
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
@ -1857,7 +1929,7 @@ namespace OpenSim.Region.Framework.Scenes
pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize));
// y + 1
}