From 31a61bbeec5aae6b679ffa53e2966420e774f301 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Tue, 13 Oct 2009 22:03:00 -0400 Subject: * 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. --- OpenSim/Region/Framework/Scenes/Scene.cs | 114 +++++++++++++++++++++++++------ 1 file changed, 93 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 949cf19..0f351ce 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -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 } -- cgit v1.1