refactor: Add RegionConnection.PosX and PosY to return position in meters rather than copy/pasting the necessary calculations in lots of places.
parent
fb8705dd4d
commit
824a3a114b
|
@ -408,11 +408,7 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
//xxy
|
//xxy
|
||||||
//xxx
|
//xxx
|
||||||
|
|
||||||
|
if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
|
||||||
if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd
|
|
||||||
>= (newConn.X * (int)Constants.RegionSize))
|
|
||||||
&& (((int)rootConn.Y * (int)Constants.RegionSize)
|
|
||||||
>= (newConn.Y * (int)Constants.RegionSize)))
|
|
||||||
{
|
{
|
||||||
connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
|
connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
|
||||||
break;
|
break;
|
||||||
|
@ -422,10 +418,7 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
//xyx
|
//xyx
|
||||||
//xxx
|
//xxx
|
||||||
//xxx
|
//xxx
|
||||||
if ((((int)rootConn.X * (int)Constants.RegionSize)
|
if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
|
||||||
>= (newConn.X * (int)Constants.RegionSize))
|
|
||||||
&& (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd
|
|
||||||
>= (newConn.Y * (int)Constants.RegionSize)))
|
|
||||||
{
|
{
|
||||||
connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene);
|
connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene);
|
||||||
break;
|
break;
|
||||||
|
@ -435,10 +428,7 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
//xxy
|
//xxy
|
||||||
//xxx
|
//xxx
|
||||||
//xxx
|
//xxx
|
||||||
if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd
|
if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
|
||||||
>= (newConn.X * (int)Constants.RegionSize))
|
|
||||||
&& (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd
|
|
||||||
>= (newConn.Y * (int)Constants.RegionSize)))
|
|
||||||
{
|
{
|
||||||
connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene);
|
connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene);
|
||||||
break;
|
break;
|
||||||
|
@ -460,10 +450,8 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||||
{
|
{
|
||||||
Vector3 offset = Vector3.Zero;
|
Vector3 offset = Vector3.Zero;
|
||||||
offset.X = (((newConn.X * (int)Constants.RegionSize)) -
|
offset.X = newConn.PosX - rootConn.PosX;
|
||||||
((rootConn.X * (int)Constants.RegionSize)));
|
offset.Y = newConn.PosY - rootConn.PosY;
|
||||||
offset.Y = (((newConn.Y * (int)Constants.RegionSize)) -
|
|
||||||
((rootConn.Y * (int)Constants.RegionSize)));
|
|
||||||
|
|
||||||
Vector3 extents = Vector3.Zero;
|
Vector3 extents = Vector3.Zero;
|
||||||
extents.Y = rootConn.YEnd;
|
extents.Y = rootConn.YEnd;
|
||||||
|
@ -529,10 +517,8 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||||
{
|
{
|
||||||
Vector3 offset = Vector3.Zero;
|
Vector3 offset = Vector3.Zero;
|
||||||
offset.X = (((newConn.X * (int)Constants.RegionSize)) -
|
offset.X = newConn.PosX - rootConn.PosX;
|
||||||
((rootConn.X * (int)Constants.RegionSize)));
|
offset.Y = newConn.PosY - rootConn.PosY;
|
||||||
offset.Y = (((newConn.Y * (int)Constants.RegionSize)) -
|
|
||||||
((rootConn.Y * (int)Constants.RegionSize)));
|
|
||||||
|
|
||||||
Vector3 extents = Vector3.Zero;
|
Vector3 extents = Vector3.Zero;
|
||||||
extents.Y = newConn.YEnd + rootConn.YEnd;
|
extents.Y = newConn.YEnd + rootConn.YEnd;
|
||||||
|
@ -589,10 +575,8 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||||
{
|
{
|
||||||
Vector3 offset = Vector3.Zero;
|
Vector3 offset = Vector3.Zero;
|
||||||
offset.X = (((newConn.X * (int)Constants.RegionSize)) -
|
offset.X = newConn.PosX - rootConn.PosX;
|
||||||
((rootConn.X * (int)Constants.RegionSize)));
|
offset.Y = newConn.PosY - rootConn.PosY;
|
||||||
offset.Y = (((newConn.Y * (int)Constants.RegionSize)) -
|
|
||||||
((rootConn.Y * (int)Constants.RegionSize)));
|
|
||||||
|
|
||||||
Vector3 extents = Vector3.Zero;
|
Vector3 extents = Vector3.Zero;
|
||||||
|
|
||||||
|
@ -622,7 +606,7 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
|
|
||||||
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||||
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||||
|
|
||||||
lock (rootConn.RegionScene.NorthBorders)
|
lock (rootConn.RegionScene.NorthBorders)
|
||||||
{
|
{
|
||||||
if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2)
|
if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2)
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
@ -49,17 +50,45 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
/// LargeLandChannel for combined region
|
/// LargeLandChannel for combined region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ILandChannel RegionLandChannel;
|
public ILandChannel RegionLandChannel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The x map co-ordinate for this region (where each co-ordinate is a Constants.RegionSize block).
|
||||||
|
/// </summary>
|
||||||
public uint X;
|
public uint X;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The y co-ordinate for this region (where each cor-odinate is a Constants.RegionSize block).
|
||||||
|
/// </summary>
|
||||||
public uint Y;
|
public uint Y;
|
||||||
public int XEnd;
|
|
||||||
public int YEnd;
|
/// <summary>
|
||||||
|
/// The X meters position of this connection.
|
||||||
|
/// </summary>
|
||||||
|
public uint PosX { get { return X * Constants.RegionSize; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Y meters co-ordinate of this connection.
|
||||||
|
/// </summary>
|
||||||
|
public uint PosY { get { return Y * Constants.RegionSize; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the megaregion in meters.
|
||||||
|
/// </summary>
|
||||||
|
public uint XEnd;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the megaregion in meters.
|
||||||
|
/// </summary>
|
||||||
|
public uint YEnd;
|
||||||
|
|
||||||
public List<RegionData> ConnectedRegions;
|
public List<RegionData> ConnectedRegions;
|
||||||
public RegionCombinerPermissionModule PermissionModule;
|
public RegionCombinerPermissionModule PermissionModule;
|
||||||
public RegionCombinerClientEventForwarder ClientEventForwarder;
|
public RegionCombinerClientEventForwarder ClientEventForwarder;
|
||||||
|
|
||||||
public void UpdateExtents(Vector3 extents)
|
public void UpdateExtents(Vector3 extents)
|
||||||
{
|
{
|
||||||
XEnd = (int)extents.X;
|
XEnd = (uint)extents.X;
|
||||||
YEnd = (int)extents.Y;
|
YEnd = (uint)extents.Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue