aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs52
1 files changed, 15 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 7861a54..49d3b9b 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -2174,16 +2174,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2174 // The first region is the home region of the passed scene presence. 2174 // The first region is the home region of the passed scene presence.
2175 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) 2175 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
2176 { 2176 {
2177 /* 2177 return new Vector3(sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
2178 int rRegionX = (int)sp.Scene.RegionInfo.LegacyRegionLocX;
2179 int rRegionY = (int)sp.Scene.RegionInfo.LegacyRegionLocY;
2180 int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize;
2181 int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize;
2182 int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize;
2183 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
2184 return new Vector3(shiftx, shifty, 0f);
2185 */
2186 return new Vector3(sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
2187 sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, 2178 sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
2188 0f); 2179 0f);
2189 } 2180 }
@@ -2543,28 +2534,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2543 if (scene == null) 2534 if (scene == null)
2544 return null; 2535 return null;
2545 2536
2546 RegionInfo srcRegionInfo = scene.RegionInfo; 2537 int x = (int)targetPosition.X + (int)scene.RegionInfo.WorldLocX;
2547 int neighbourx = (int)srcRegionInfo.RegionLocX; 2538 if (targetPosition.X >= 0)
2548 int neighboury = (int)srcRegionInfo.RegionLocY; 2539 x++;
2549 float regionSizeX = srcRegionInfo.RegionSizeX; 2540 else
2550 float regionSizeY = srcRegionInfo.RegionSizeY; 2541 x--;
2551
2552 float edgeJitter = 0.2f;
2553
2554 if (targetPosition.X < edgeJitter)
2555 neighbourx--;
2556 else if (targetPosition.X > regionSizeX - edgeJitter)
2557 neighbourx += (int)(regionSizeX / Constants.RegionSize);
2558 2542
2559 if (targetPosition.Y < edgeJitter) 2543 int y = (int)targetPosition.Y + (int)scene.RegionInfo.WorldLocY;
2560 neighboury--; 2544 if (targetPosition.Y >= 0)
2561 else if (targetPosition.Y > regionSizeY - edgeJitter) 2545 y++;
2562 neighboury += (int)(regionSizeY / Constants.RegionSize); 2546 else
2547 y--;
2563 2548
2564 int x = neighbourx * (int)Constants.RegionSize;
2565 int y = neighboury * (int)Constants.RegionSize;
2566 2549
2567 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 2550 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID,x,y);
2568 if (neighbourRegion == null) 2551 if (neighbourRegion == null)
2569 { 2552 {
2570 return null; 2553 return null;
@@ -2577,15 +2560,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2577 if (newRegionSizeY == 0) 2560 if (newRegionSizeY == 0)
2578 newRegionSizeY = Constants.RegionSize; 2561 newRegionSizeY = Constants.RegionSize;
2579 2562
2580 if (targetPosition.X < edgeJitter)
2581 newpos.X += newRegionSizeX;
2582 else if (targetPosition.X > regionSizeX - edgeJitter)
2583 newpos.X -= regionSizeX;
2584 2563
2585 if (targetPosition.Y < edgeJitter) 2564 newpos.X = targetPosition.X - (neighbourRegion.RegionLocX - (int)scene.RegionInfo.WorldLocX);
2586 newpos.Y += newRegionSizeY; 2565 newpos.Y = targetPosition.Y - (neighbourRegion.RegionLocY - (int)scene.RegionInfo.WorldLocY);
2587 else if (targetPosition.Y > regionSizeY - edgeJitter) 2566
2588 newpos.Y -= regionSizeY;
2589 2567
2590 const float enterDistance = 0.2f; 2568 const float enterDistance = 0.2f;
2591 newpos.X = Util.Clamp(newpos.X, enterDistance, newRegionSizeX - enterDistance); 2569 newpos.X = Util.Clamp(newpos.X, enterDistance, newRegionSizeX - enterDistance);