aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs')
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs321
1 files changed, 62 insertions, 259 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 7127c73..a7ffad0 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -44,6 +44,7 @@ namespace OpenSim.Region.RegionCombinerModule
44 public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule 44 public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private static string LogHeader = "[REGION COMBINER MODULE]";
47 48
48 public string Name 49 public string Name
49 { 50 {
@@ -134,6 +135,49 @@ namespace OpenSim.Region.RegionCombinerModule
134 throw new Exception(string.Format("Region with id {0} not found", regionId)); 135 throw new Exception(string.Format("Region with id {0} not found", regionId));
135 } 136 }
136 137
138 // Test to see if this postiion (relative to the region) is within the area covered
139 // by this megaregion.
140 public bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy)
141 {
142 bool ret = false;
143 if (xx < 0 || yy < 0)
144 return ret;
145
146 foreach (RegionConnections rootRegion in m_regions.Values)
147 {
148 if (currentRegion == rootRegion.RegionId)
149 {
150 // The caller is in the root region so this is an easy test
151 if (xx < rootRegion.XEnd && yy < rootRegion.YEnd)
152 {
153 ret = true;
154 }
155 break;
156 }
157 else
158 {
159 // Maybe the caller is in one of the sub-regions
160 foreach (RegionData childRegion in rootRegion.ConnectedRegions)
161 {
162 if (currentRegion == childRegion.RegionId)
163 {
164 // This is a child. Diddle the offsets and check if in
165 Vector3 positionInMegaregion = childRegion.Offset;
166 positionInMegaregion.X += xx;
167 positionInMegaregion.Y += yy;
168 if (positionInMegaregion.X < rootRegion.XEnd && positionInMegaregion.Y < rootRegion.YEnd)
169 {
170 ret = true;
171 }
172 break;
173 }
174 }
175 }
176 }
177
178 return ret;
179 }
180
137 private void NewPresence(ScenePresence presence) 181 private void NewPresence(ScenePresence presence)
138 { 182 {
139 if (presence.IsChildAgent) 183 if (presence.IsChildAgent)
@@ -220,27 +264,6 @@ namespace OpenSim.Region.RegionCombinerModule
220 // 264 //
221*/ 265*/
222 266
223 // Give each region a standard set of non-infinite borders
224 Border northBorder = new Border();
225 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
226 northBorder.CrossDirection = Cardinals.N;
227 scene.NorthBorders[0] = northBorder;
228
229 Border southBorder = new Border();
230 southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
231 southBorder.CrossDirection = Cardinals.S;
232 scene.SouthBorders[0] = southBorder;
233
234 Border eastBorder = new Border();
235 eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
236 eastBorder.CrossDirection = Cardinals.E;
237 scene.EastBorders[0] = eastBorder;
238
239 Border westBorder = new Border();
240 westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
241 westBorder.CrossDirection = Cardinals.W;
242 scene.WestBorders[0] = westBorder;
243
244 RegionConnections newConn = new RegionConnections(); 267 RegionConnections newConn = new RegionConnections();
245 newConn.ConnectedRegions = new List<RegionData>(); 268 newConn.ConnectedRegions = new List<RegionData>();
246 newConn.RegionScene = scene; 269 newConn.RegionScene = scene;
@@ -248,8 +271,8 @@ namespace OpenSim.Region.RegionCombinerModule
248 newConn.RegionId = scene.RegionInfo.originRegionID; 271 newConn.RegionId = scene.RegionInfo.originRegionID;
249 newConn.X = scene.RegionInfo.RegionLocX; 272 newConn.X = scene.RegionInfo.RegionLocX;
250 newConn.Y = scene.RegionInfo.RegionLocY; 273 newConn.Y = scene.RegionInfo.RegionLocY;
251 newConn.XEnd = (int)Constants.RegionSize; 274 newConn.XEnd = scene.RegionInfo.RegionSizeX;
252 newConn.YEnd = (int)Constants.RegionSize; 275 newConn.YEnd = scene.RegionInfo.RegionSizeX;
253 276
254 lock (m_regions) 277 lock (m_regions)
255 { 278 {
@@ -415,6 +438,11 @@ namespace OpenSim.Region.RegionCombinerModule
415 */ 438 */
416 #endregion 439 #endregion
417 440
441
442 // Check to see if this new region is adjacent to the root region.
443 // Note that we expect the regions to be combined from the root region outward
444 // thus the requirement for the ordering in the configuration files.
445
418 // If we're one region over +x y (i.e. root region is to the west) 446 // If we're one region over +x y (i.e. root region is to the west)
419 //xxx 447 //xxx
420 //xxy 448 //xxy
@@ -431,7 +459,7 @@ namespace OpenSim.Region.RegionCombinerModule
431 //xxx 459 //xxx
432 if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) 460 if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
433 { 461 {
434 connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene); 462 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
435 break; 463 break;
436 } 464 }
437 465
@@ -441,9 +469,8 @@ namespace OpenSim.Region.RegionCombinerModule
441 //xxx 469 //xxx
442 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) 470 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
443 { 471 {
444 connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene); 472 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
445 break; 473 break;
446
447 } 474 }
448 } 475 }
449 476
@@ -453,20 +480,20 @@ namespace OpenSim.Region.RegionCombinerModule
453 DoWorkForRootRegion(newConn, scene); 480 DoWorkForRootRegion(newConn, scene);
454 } 481 }
455 } 482 }
456
457 // Set up infinite borders around the entire AABB of the combined ConnectedRegions
458 AdjustLargeRegionBounds();
459 } 483 }
460 484
461 private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) 485 private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
462 { 486 {
487 // Offset (in meters) from the base of this region to the base of the root region.
463 Vector3 offset = Vector3.Zero; 488 Vector3 offset = Vector3.Zero;
464 offset.X = newConn.PosX - rootConn.PosX; 489 offset.X = newConn.PosX - rootConn.PosX;
465 offset.Y = newConn.PosY - rootConn.PosY; 490 offset.Y = newConn.PosY - rootConn.PosY;
466 491
492 // The new total size of the region (in meters)
493 // We just extend the X and Y dimensions so the extent might temporarily include areas without regions.
467 Vector3 extents = Vector3.Zero; 494 Vector3 extents = Vector3.Zero;
468 extents.Y = rootConn.YEnd; 495 extents.X = Math.Max(rootConn.XEnd, offset.X + newConn.RegionScene.RegionInfo.RegionSizeX);
469 extents.X = rootConn.XEnd + newConn.XEnd; 496 extents.Y = Math.Max(rootConn.YEnd, offset.Y + newConn.RegionScene.RegionInfo.RegionSizeY);
470 497
471 rootConn.UpdateExtents(extents); 498 rootConn.UpdateExtents(extents);
472 499
@@ -475,9 +502,6 @@ namespace OpenSim.Region.RegionCombinerModule
475 rootConn.RegionScene.RegionInfo.RegionName, 502 rootConn.RegionScene.RegionInfo.RegionName,
476 newConn.RegionScene.RegionInfo.RegionName, offset, extents); 503 newConn.RegionScene.RegionInfo.RegionName, offset, extents);
477 504
478 scene.BordersLocked = true;
479 rootConn.RegionScene.BordersLocked = true;
480
481 RegionData ConnectedRegion = new RegionData(); 505 RegionData ConnectedRegion = new RegionData();
482 ConnectedRegion.Offset = offset; 506 ConnectedRegion.Offset = offset;
483 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; 507 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
@@ -490,34 +514,10 @@ namespace OpenSim.Region.RegionCombinerModule
490 // Inform Child region that it needs to forward it's terrain to the root region 514 // Inform Child region that it needs to forward it's terrain to the root region
491 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); 515 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
492 516
493 // Extend the borders as appropriate
494 lock (rootConn.RegionScene.EastBorders)
495 rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
496
497 lock (rootConn.RegionScene.NorthBorders)
498 rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
499
500 lock (rootConn.RegionScene.SouthBorders)
501 rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
502
503 lock (scene.WestBorders)
504 {
505 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
506
507 // Trigger auto teleport to root region
508 scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
509 scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
510 }
511
512 // Reset Terrain.. since terrain loads before we get here, we need to load 517 // Reset Terrain.. since terrain loads before we get here, we need to load
513 // it again so it loads in the root region 518 // it again so it loads in the root region
514
515 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 519 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
516 520
517 // Unlock borders
518 rootConn.RegionScene.BordersLocked = false;
519 scene.BordersLocked = false;
520
521 // Create a client event forwarder and add this region's events to the root region. 521 // Create a client event forwarder and add this region's events to the root region.
522 if (rootConn.ClientEventForwarder != null) 522 if (rootConn.ClientEventForwarder != null)
523 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); 523 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
@@ -525,6 +525,9 @@ namespace OpenSim.Region.RegionCombinerModule
525 return true; 525 return true;
526 } 526 }
527 527
528 /*
529 * 20140215 radams1: The border stuff was removed and the addition of regions to the mega-regions
530 * was generalized. These functions are not needed for the generalized solution but left for reference.
528 private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) 531 private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
529 { 532 {
530 Vector3 offset = Vector3.Zero; 533 Vector3 offset = Vector3.Zero;
@@ -536,9 +539,6 @@ namespace OpenSim.Region.RegionCombinerModule
536 extents.X = rootConn.XEnd; 539 extents.X = rootConn.XEnd;
537 rootConn.UpdateExtents(extents); 540 rootConn.UpdateExtents(extents);
538 541
539 scene.BordersLocked = true;
540 rootConn.RegionScene.BordersLocked = true;
541
542 RegionData ConnectedRegion = new RegionData(); 542 RegionData ConnectedRegion = new RegionData();
543 ConnectedRegion.Offset = offset; 543 ConnectedRegion.Offset = offset;
544 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; 544 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
@@ -553,30 +553,11 @@ namespace OpenSim.Region.RegionCombinerModule
553 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); 553 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
554 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); 554 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
555 555
556 lock (rootConn.RegionScene.NorthBorders)
557 rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
558
559 lock (rootConn.RegionScene.EastBorders)
560 rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
561
562 lock (rootConn.RegionScene.WestBorders)
563 rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
564
565 lock (scene.SouthBorders)
566 {
567 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
568 scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
569 scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
570 }
571
572 // Reset Terrain.. since terrain normally loads first. 556 // Reset Terrain.. since terrain normally loads first.
573 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 557 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
574 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 558 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
575 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 559 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
576 560
577 scene.BordersLocked = false;
578 rootConn.RegionScene.BordersLocked = false;
579
580 if (rootConn.ClientEventForwarder != null) 561 if (rootConn.ClientEventForwarder != null)
581 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); 562 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
582 563
@@ -600,9 +581,6 @@ namespace OpenSim.Region.RegionCombinerModule
600 extents.Y = rootConn.YEnd; 581 extents.Y = rootConn.YEnd;
601 extents.X = rootConn.XEnd; 582 extents.X = rootConn.XEnd;
602 583
603 scene.BordersLocked = true;
604 rootConn.RegionScene.BordersLocked = true;
605
606 RegionData ConnectedRegion = new RegionData(); 584 RegionData ConnectedRegion = new RegionData();
607 ConnectedRegion.Offset = offset; 585 ConnectedRegion.Offset = offset;
608 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; 586 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
@@ -618,67 +596,10 @@ namespace OpenSim.Region.RegionCombinerModule
618 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); 596 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
619 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); 597 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
620 598
621 lock (rootConn.RegionScene.NorthBorders)
622 {
623 if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2)
624 {
625 //compound border
626 // already locked above
627 rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
628
629 lock (rootConn.RegionScene.EastBorders)
630 rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
631
632 lock (rootConn.RegionScene.WestBorders)
633 rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
634 }
635 }
636
637 lock (scene.SouthBorders)
638 {
639 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
640 scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
641 scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
642 }
643
644 lock (rootConn.RegionScene.EastBorders)
645 {
646 if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
647 {
648 rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
649
650 lock (rootConn.RegionScene.NorthBorders)
651 rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
652
653 lock (rootConn.RegionScene.SouthBorders)
654 rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
655 }
656 }
657
658 lock (scene.WestBorders)
659 {
660 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
661 scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
662 scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
663 }
664
665 /*
666 else
667 {
668 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
669 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
670 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
671 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
672 }
673 */
674
675
676 // Reset Terrain.. since terrain normally loads first. 599 // Reset Terrain.. since terrain normally loads first.
677 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 600 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
678 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 601 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
679 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 602 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
680 scene.BordersLocked = false;
681 rootConn.RegionScene.BordersLocked = false;
682 603
683 if (rootConn.ClientEventForwarder != null) 604 if (rootConn.ClientEventForwarder != null)
684 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); 605 rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
@@ -687,6 +608,7 @@ namespace OpenSim.Region.RegionCombinerModule
687 608
688 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); 609 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
689 } 610 }
611 */
690 612
691 private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene) 613 private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene)
692 { 614 {
@@ -885,125 +807,6 @@ namespace OpenSim.Region.RegionCombinerModule
885// } 807// }
886// } 808// }
887 809
888 // Create a set of infinite borders around the whole aabb of the combined island.
889 private void AdjustLargeRegionBounds()
890 {
891 lock (m_regions)
892 {
893 foreach (RegionConnections rconn in m_regions.Values)
894 {
895 Vector3 offset = Vector3.Zero;
896 rconn.RegionScene.BordersLocked = true;
897 foreach (RegionData rdata in rconn.ConnectedRegions)
898 {
899 if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
900 if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
901 }
902
903 lock (rconn.RegionScene.NorthBorders)
904 {
905 Border northBorder = null;
906 // If we don't already have an infinite border, create one.
907 if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
908 {
909 northBorder = new Border();
910 rconn.RegionScene.NorthBorders.Add(northBorder);
911 }
912
913 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
914 offset.Y + (int) Constants.RegionSize); //<---
915 northBorder.CrossDirection = Cardinals.N;
916 }
917
918 lock (rconn.RegionScene.SouthBorders)
919 {
920 Border southBorder = null;
921 // If we don't already have an infinite border, create one.
922 if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
923 {
924 southBorder = new Border();
925 rconn.RegionScene.SouthBorders.Add(southBorder);
926 }
927 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
928 southBorder.CrossDirection = Cardinals.S;
929 }
930
931 lock (rconn.RegionScene.EastBorders)
932 {
933 Border eastBorder = null;
934 // If we don't already have an infinite border, create one.
935 if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
936 {
937 eastBorder = new Border();
938 rconn.RegionScene.EastBorders.Add(eastBorder);
939 }
940 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
941 //<---
942 eastBorder.CrossDirection = Cardinals.E;
943 }
944
945 lock (rconn.RegionScene.WestBorders)
946 {
947 Border westBorder = null;
948 // If we don't already have an infinite border, create one.
949 if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
950 {
951 westBorder = new Border();
952 rconn.RegionScene.WestBorders.Add(westBorder);
953
954 }
955 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
956 westBorder.CrossDirection = Cardinals.W;
957 }
958
959 rconn.RegionScene.BordersLocked = false;
960 }
961 }
962 }
963
964 /// <summary>
965 /// Try and get an Infinite border out of a listT of borders
966 /// </summary>
967 /// <param name="borders"></param>
968 /// <param name="oborder"></param>
969 /// <returns></returns>
970 public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
971 {
972 // Warning! Should be locked before getting here!
973 foreach (Border b in borders)
974 {
975 if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
976 {
977 oborder = b;
978 return true;
979 }
980 }
981
982 oborder = null;
983 return false;
984 }
985
986 public RegionData GetRegionFromPosition(Vector3 pPosition)
987 {
988 pPosition = pPosition/(int) Constants.RegionSize;
989 int OffsetX = (int) pPosition.X;
990 int OffsetY = (int) pPosition.Y;
991
992 lock (m_regions)
993 {
994 foreach (RegionConnections regConn in m_regions.Values)
995 {
996 foreach (RegionData reg in regConn.ConnectedRegions)
997 {
998 if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
999 return reg;
1000 }
1001 }
1002 }
1003
1004 return new RegionData();
1005 }
1006
1007 public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion) 810 public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
1008 { 811 {
1009 if (BigRegion.PermissionModule == null) 812 if (BigRegion.PermissionModule == null)