aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
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')
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs36
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionConnections.cs37
2 files changed, 43 insertions, 30 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)
diff --git a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/RegionCombinerModule/RegionConnections.cs
index 3aa9f20..fba51d2 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionConnections.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework;
31using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33 34
@@ -49,17 +50,45 @@ namespace OpenSim.Region.RegionCombinerModule
49 /// LargeLandChannel for combined region 50 /// LargeLandChannel for combined region
50 /// </summary> 51 /// </summary>
51 public ILandChannel RegionLandChannel; 52 public ILandChannel RegionLandChannel;
53
54 /// <summary>
55 /// The x map co-ordinate for this region (where each co-ordinate is a Constants.RegionSize block).
56 /// </summary>
52 public uint X; 57 public uint X;
58
59 /// <summary>
60 /// The y co-ordinate for this region (where each cor-odinate is a Constants.RegionSize block).
61 /// </summary>
53 public uint Y; 62 public uint Y;
54 public int XEnd; 63
55 public int YEnd; 64 /// <summary>
65 /// The X meters position of this connection.
66 /// </summary>
67 public uint PosX { get { return X * Constants.RegionSize; } }
68
69 /// <summary>
70 /// The Y meters co-ordinate of this connection.
71 /// </summary>
72 public uint PosY { get { return Y * Constants.RegionSize; } }
73
74 /// <summary>
75 /// The size of the megaregion in meters.
76 /// </summary>
77 public uint XEnd;
78
79 /// <summary>
80 /// The size of the megaregion in meters.
81 /// </summary>
82 public uint YEnd;
83
56 public List<RegionData> ConnectedRegions; 84 public List<RegionData> ConnectedRegions;
57 public RegionCombinerPermissionModule PermissionModule; 85 public RegionCombinerPermissionModule PermissionModule;
58 public RegionCombinerClientEventForwarder ClientEventForwarder; 86 public RegionCombinerClientEventForwarder ClientEventForwarder;
87
59 public void UpdateExtents(Vector3 extents) 88 public void UpdateExtents(Vector3 extents)
60 { 89 {
61 XEnd = (int)extents.X; 90 XEnd = (uint)extents.X;
62 YEnd = (int)extents.Y; 91 YEnd = (uint)extents.Y;
63 } 92 }
64 } 93 }
65} \ No newline at end of file 94} \ No newline at end of file