aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-09-01 19:38:45 -0400
committerTeravus Ovares (Dan Olivares)2009-09-01 19:38:45 -0400
commitafc72cc10edb2d930a67670a807ab69ded746461 (patch)
tree67458df0a22569149afb24b9d1d3cf9956d078cb /OpenSim/Region
parent* The return of fuzzy borders! (diff)
downloadopensim-SC-afc72cc10edb2d930a67670a807ab69ded746461.zip
opensim-SC-afc72cc10edb2d930a67670a807ab69ded746461.tar.gz
opensim-SC-afc72cc10edb2d930a67670a807ab69ded746461.tar.bz2
opensim-SC-afc72cc10edb2d930a67670a807ab69ded746461.tar.xz
* Fixes diagonal teleporting when in RegionCombining mode by adding 4 additional borders that have infinite distances perpendicular to the cardinal of the border surrounding the entire combined region. Recalculates this boundary each time AddScene is called.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs61
1 files changed, 50 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 4e03e95..035e6f8 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -475,6 +475,7 @@ namespace OpenSim.Region.CoreModules.World.Land
475 } 475 }
476 476
477 } 477 }
478 AdjustLargeRegionBounds();
478 479
479 } 480 }
480 481
@@ -495,7 +496,7 @@ namespace OpenSim.Region.CoreModules.World.Land
495 } 496 }
496 497
497 // Create a set of infinite borders around the whole aabb of the combined island. 498 // Create a set of infinite borders around the whole aabb of the combined island.
498 private void MakeLargeRegionBounds() 499 private void AdjustLargeRegionBounds()
499 { 500 {
500 lock (m_regions) 501 lock (m_regions)
501 { 502 {
@@ -512,36 +513,60 @@ namespace OpenSim.Region.CoreModules.World.Land
512 513
513 lock (rconn.RegionScene.NorthBorders) 514 lock (rconn.RegionScene.NorthBorders)
514 { 515 {
515 Border northBorder = new Border(); 516
517 Border northBorder = null;
518
519 if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
520 {
521 northBorder = new Border();
522 rconn.RegionScene.NorthBorders.Add(northBorder);
523 }
524
516 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 525 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
517 offset.Y); //<--- 526 offset.Y + (int) Constants.RegionSize); //<---
518 northBorder.CrossDirection = Cardinals.N; 527 northBorder.CrossDirection = Cardinals.N;
519 rconn.RegionScene.NorthBorders.Add(northBorder); 528
520 } 529 }
521 530
522 lock (rconn.RegionScene.SouthBorders) 531 lock (rconn.RegionScene.SouthBorders)
523 { 532 {
524 Border southBorder = new Border(); 533 Border southBorder = null;
534 if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
535 {
536 southBorder = new Border();
537 rconn.RegionScene.SouthBorders.Add(southBorder);
538 }
525 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> 539 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
526 southBorder.CrossDirection = Cardinals.S; 540 southBorder.CrossDirection = Cardinals.S;
527 rconn.RegionScene.SouthBorders.Add(southBorder); 541
528 } 542 }
529 543
530 lock (rconn.RegionScene.EastBorders) 544 lock (rconn.RegionScene.EastBorders)
531 { 545 {
532 Border eastBorder = new Border(); 546 Border eastBorder = null;
533 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.Y); 547 if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
548 {
549 eastBorder = new Border();
550 rconn.RegionScene.EastBorders.Add(eastBorder);
551 }
552 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
534 //<--- 553 //<---
535 eastBorder.CrossDirection = Cardinals.E; 554 eastBorder.CrossDirection = Cardinals.E;
536 rconn.RegionScene.EastBorders.Add(eastBorder); 555
537 } 556 }
538 557
539 lock (rconn.RegionScene.WestBorders) 558 lock (rconn.RegionScene.WestBorders)
540 { 559 {
541 Border westBorder = new Border(); 560 Border westBorder = null;
561 if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
562 {
563 westBorder = new Border();
564 rconn.RegionScene.WestBorders.Add(westBorder);
565
566 }
542 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> 567 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
543 westBorder.CrossDirection = Cardinals.W; 568 westBorder.CrossDirection = Cardinals.W;
544 rconn.RegionScene.WestBorders.Add(westBorder); 569
545 } 570 }
546 571
547 572
@@ -551,6 +576,20 @@ namespace OpenSim.Region.CoreModules.World.Land
551 } 576 }
552 } 577 }
553 578
579 public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
580 {
581 // Warning! Should be locked before getting here!
582 foreach (Border b in borders)
583 {
584 if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
585 {
586 oborder = b;
587 return true;
588 }
589 }
590 oborder = null;
591 return false;
592 }
554 593
555 public RegionData GetRegionFromPosition(Vector3 pPosition) 594 public RegionData GetRegionFromPosition(Vector3 pPosition)
556 { 595 {