diff options
author | Robert Adams | 2014-02-15 16:01:43 -0800 |
---|---|---|
committer | Robert Adams | 2014-02-15 16:01:43 -0800 |
commit | 877bdcdce1533d8dc3e13c0def7b015080ee881e (patch) | |
tree | 38dba2a95f035eea5b64aeba9bf59385de63faee /OpenSim/Region/CoreModules | |
parent | Non-functional changes of numbers into symbolic references and a few (diff) | |
download | opensim-SC_OLD-877bdcdce1533d8dc3e13c0def7b015080ee881e.zip opensim-SC_OLD-877bdcdce1533d8dc3e13c0def7b015080ee881e.tar.gz opensim-SC_OLD-877bdcdce1533d8dc3e13c0def7b015080ee881e.tar.bz2 opensim-SC_OLD-877bdcdce1533d8dc3e13c0def7b015080ee881e.tar.xz |
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)
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a038f73..3eff96e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -464,7 +464,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
464 | sp.Name, position, sp.Scene.RegionInfo.RegionName); | 464 | sp.Name, position, sp.Scene.RegionInfo.RegionName); |
465 | 465 | ||
466 | // Teleport within the same region | 466 | // Teleport within the same region |
467 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) | 467 | if (!sp.Scene.PositionIsInCurrentRegion(position) || position.Z < 0) |
468 | { | 468 | { |
469 | Vector3 emergencyPos = new Vector3(128, 128, 128); | 469 | Vector3 emergencyPos = new Vector3(128, 128, 128); |
470 | 470 | ||
@@ -580,7 +580,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
580 | MapBlockData block = new MapBlockData(); | 580 | MapBlockData block = new MapBlockData(); |
581 | block.X = (ushort)regX; | 581 | block.X = (ushort)regX; |
582 | block.Y = (ushort)regY; | 582 | block.Y = (ushort)regY; |
583 | block.Access = 254; // == not there | 583 | block.Access = (byte)SimAccess.Down; |
584 | 584 | ||
585 | List<MapBlockData> blocks = new List<MapBlockData>(); | 585 | List<MapBlockData> blocks = new List<MapBlockData>(); |
586 | blocks.Add(block); | 586 | blocks.Add(block); |
@@ -713,10 +713,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
713 | return; | 713 | return; |
714 | } | 714 | } |
715 | 715 | ||
716 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 716 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; |
717 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 717 | Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY); |
718 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); | 718 | Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY); |
719 | uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); | ||
720 | 719 | ||
721 | ulong destinationHandle = finalDestination.RegionHandle; | 720 | ulong destinationHandle = finalDestination.RegionHandle; |
722 | 721 | ||
@@ -1333,6 +1332,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1333 | return region; | 1332 | return region; |
1334 | } | 1333 | } |
1335 | 1334 | ||
1335 | // This returns 'true' if the new region already has a child agent for our | ||
1336 | // incoming agent. The implication is that, if 'false', we have to create the | ||
1337 | // child and then teleport into the region. | ||
1336 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 1338 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) |
1337 | { | 1339 | { |
1338 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | 1340 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
@@ -1357,20 +1359,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1357 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | 1359 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); |
1358 | } | 1360 | } |
1359 | 1361 | ||
1360 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) | ||
1361 | { | ||
1362 | if (s.TestBorderCross(pos, Cardinals.N)) | ||
1363 | return true; | ||
1364 | if (s.TestBorderCross(pos, Cardinals.S)) | ||
1365 | return true; | ||
1366 | if (s.TestBorderCross(pos, Cardinals.E)) | ||
1367 | return true; | ||
1368 | if (s.TestBorderCross(pos, Cardinals.W)) | ||
1369 | return true; | ||
1370 | |||
1371 | return false; | ||
1372 | } | ||
1373 | |||
1374 | #endregion | 1362 | #endregion |
1375 | 1363 | ||
1376 | #region Landmark Teleport | 1364 | #region Landmark Teleport |
@@ -2077,7 +2065,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2077 | public NotFoundLocationCache() | 2065 | public NotFoundLocationCache() |
2078 | { | 2066 | { |
2079 | } | 2067 | } |
2080 | // Add an area to the lost of 'not found' places. The area is the snapped region | 2068 | // Add an area to the list of 'not found' places. The area is the snapped region |
2081 | // area around the added point. | 2069 | // area around the added point. |
2082 | public void Add(double pX, double pY) | 2070 | public void Add(double pX, double pY) |
2083 | { | 2071 | { |
@@ -2305,23 +2293,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2305 | /// <param name='neCorner'></param> | 2293 | /// <param name='neCorner'></param> |
2306 | private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner) | 2294 | private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner) |
2307 | { | 2295 | { |
2308 | Border[] northBorders = Scene.NorthBorders.ToArray(); | ||
2309 | Border[] eastBorders = Scene.EastBorders.ToArray(); | ||
2310 | |||
2311 | Vector2 extent = Vector2.Zero; | 2296 | Vector2 extent = Vector2.Zero; |
2312 | for (int i = 0; i < eastBorders.Length; i++) | 2297 | |
2313 | { | 2298 | if (m_regionCombinerModule != null) |
2314 | extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; | ||
2315 | } | ||
2316 | for (int i = 0; i < northBorders.Length; i++) | ||
2317 | { | 2299 | { |
2318 | extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; | 2300 | Vector2 megaRegionSize = m_regionCombinerModule.GetSizeOfMegaregion(Scene.RegionInfo.RegionID); |
2301 | extent.X = (float)Util.WorldToRegionLoc((uint)megaRegionSize.X); | ||
2302 | extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y); | ||
2319 | } | 2303 | } |
2320 | 2304 | ||
2321 | // Loss of fraction on purpose | ||
2322 | extent.X = ((int)extent.X / (int)Constants.RegionSize); | ||
2323 | extent.Y = ((int)extent.Y / (int)Constants.RegionSize); | ||
2324 | |||
2325 | swCorner.X = Scene.RegionInfo.RegionLocX - 1; | 2305 | swCorner.X = Scene.RegionInfo.RegionLocX - 1; |
2326 | swCorner.Y = Scene.RegionInfo.RegionLocY - 1; | 2306 | swCorner.Y = Scene.RegionInfo.RegionLocY - 1; |
2327 | neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; | 2307 | neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; |