aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-19 04:22:30 +0100
committerJustin Clark-Casey (justincc)2012-05-19 04:22:30 +0100
commit824a3a114b1142325f523e2039ed070cce9ea850 (patch)
treed901fda67a9c6d7ca613834a64e4ca3cb5b7ffa5 /OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
parentrefactor: Rename connection paramaters from "conn" and "regionConnections" so... (diff)
downloadopensim-SC-824a3a114b1142325f523e2039ed070cce9ea850.zip
opensim-SC-824a3a114b1142325f523e2039ed070cce9ea850.tar.gz
opensim-SC-824a3a114b1142325f523e2039ed070cce9ea850.tar.bz2
opensim-SC-824a3a114b1142325f523e2039ed070cce9ea850.tar.xz
refactor: Add RegionConnection.PosX and PosY to return position in meters rather than copy/pasting the necessary calculations in lots of places.
Diffstat (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs')
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs36
1 files changed, 10 insertions, 26 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index b3750ca..81ed339 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -408,11 +408,7 @@ namespace OpenSim.Region.RegionCombinerModule
408 //xxy 408 //xxy
409 //xxx 409 //xxx
410 410
411 411 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
412 if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd
413 >= (newConn.X * (int)Constants.RegionSize))
414 && (((int)rootConn.Y * (int)Constants.RegionSize)
415 >= (newConn.Y * (int)Constants.RegionSize)))
416 { 412 {
417 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); 413 connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
418 break; 414 break;
@@ -422,10 +418,7 @@ namespace OpenSim.Region.RegionCombinerModule
422 //xyx 418 //xyx
423 //xxx 419 //xxx
424 //xxx 420 //xxx
425 if ((((int)rootConn.X * (int)Constants.RegionSize) 421 if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
426 >= (newConn.X * (int)Constants.RegionSize))
427 && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd
428 >= (newConn.Y * (int)Constants.RegionSize)))
429 { 422 {
430 connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene); 423 connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene);
431 break; 424 break;
@@ -435,10 +428,7 @@ namespace OpenSim.Region.RegionCombinerModule
435 //xxy 428 //xxy
436 //xxx 429 //xxx
437 //xxx 430 //xxx
438 if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd 431 if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
439 >= (newConn.X * (int)Constants.RegionSize))
440 && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd
441 >= (newConn.Y * (int)Constants.RegionSize)))
442 { 432 {
443 connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene); 433 connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene);
444 break; 434 break;
@@ -460,10 +450,8 @@ namespace OpenSim.Region.RegionCombinerModule
460 private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) 450 private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
461 { 451 {
462 Vector3 offset = Vector3.Zero; 452 Vector3 offset = Vector3.Zero;
463 offset.X = (((newConn.X * (int)Constants.RegionSize)) - 453 offset.X = newConn.PosX - rootConn.PosX;
464 ((rootConn.X * (int)Constants.RegionSize))); 454 offset.Y = newConn.PosY - rootConn.PosY;
465 offset.Y = (((newConn.Y * (int)Constants.RegionSize)) -
466 ((rootConn.Y * (int)Constants.RegionSize)));
467 455
468 Vector3 extents = Vector3.Zero; 456 Vector3 extents = Vector3.Zero;
469 extents.Y = rootConn.YEnd; 457 extents.Y = rootConn.YEnd;
@@ -529,10 +517,8 @@ namespace OpenSim.Region.RegionCombinerModule
529 private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) 517 private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
530 { 518 {
531 Vector3 offset = Vector3.Zero; 519 Vector3 offset = Vector3.Zero;
532 offset.X = (((newConn.X * (int)Constants.RegionSize)) - 520 offset.X = newConn.PosX - rootConn.PosX;
533 ((rootConn.X * (int)Constants.RegionSize))); 521 offset.Y = newConn.PosY - rootConn.PosY;
534 offset.Y = (((newConn.Y * (int)Constants.RegionSize)) -
535 ((rootConn.Y * (int)Constants.RegionSize)));
536 522
537 Vector3 extents = Vector3.Zero; 523 Vector3 extents = Vector3.Zero;
538 extents.Y = newConn.YEnd + rootConn.YEnd; 524 extents.Y = newConn.YEnd + rootConn.YEnd;
@@ -589,10 +575,8 @@ namespace OpenSim.Region.RegionCombinerModule
589 private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) 575 private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
590 { 576 {
591 Vector3 offset = Vector3.Zero; 577 Vector3 offset = Vector3.Zero;
592 offset.X = (((newConn.X * (int)Constants.RegionSize)) - 578 offset.X = newConn.PosX - rootConn.PosX;
593 ((rootConn.X * (int)Constants.RegionSize))); 579 offset.Y = newConn.PosY - rootConn.PosY;
594 offset.Y = (((newConn.Y * (int)Constants.RegionSize)) -
595 ((rootConn.Y * (int)Constants.RegionSize)));
596 580
597 Vector3 extents = Vector3.Zero; 581 Vector3 extents = Vector3.Zero;
598 582
@@ -622,7 +606,7 @@ namespace OpenSim.Region.RegionCombinerModule
622 606
623 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); 607 rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
624 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); 608 scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
625 609
626 lock (rootConn.RegionScene.NorthBorders) 610 lock (rootConn.RegionScene.NorthBorders)
627 { 611 {
628 if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2) 612 if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2)