From 2d2bea4aa75ff6e82384f0842fe3719bf946b1cc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 26 Dec 2013 22:45:59 -0800 Subject: varregion: many more updates removing the constant RegionSize and replacing with a passed region size. This time in the map code and grid services code. --- OpenSim/Region/Framework/Scenes/Scene.cs | 53 +--------------------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 20 ++++---- 3 files changed, 13 insertions(+), 62 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 10421ff..5a7e2dd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1099,8 +1099,6 @@ namespace OpenSim.Region.Framework.Scenes /// True after all operations complete, throws exceptions otherwise. public override void OtherRegionUp(GridRegion otherRegion) { - // uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize); - // uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize); uint xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX); uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY); @@ -2450,9 +2448,9 @@ namespace OpenSim.Region.Framework.Scenes int xx = (int)Math.Floor(pos.X); int yy = (int)Math.Floor(pos.Y); if (xx < 0 - || xx > RegionInfo.RegionSizeX + || xx >= RegionInfo.RegionSizeX || yy < 0 - || yy > RegionInfo.RegionSizeY) + || yy >= RegionInfo.RegionSizeY) ret = false; return ret; @@ -4581,53 +4579,6 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = GetScenePresence(remoteClient.AgentId); if (sp != null) { - /* - uint regionX = RegionInfo.LegacyRegionLocX; - uint regionY = RegionInfo.LegacyRegionLocY; - - Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY); - Utils.LongToUInts(regionHandle, out regionX, out regionY); - - int shiftx = (int) regionX - (int) RegionInfo.LegacyRegionLocX * (int)Constants.RegionSize; - int shifty = (int) regionY - (int) RegionInfo.LegacyRegionLocY * (int)Constants.RegionSize; - */ - - uint regionX, regionY; - Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY); - - int shiftx = (int) regionX - (int)RegionInfo.WorldLocX; - int shifty = (int) regionY - (int)RegionInfo.WorldLocY; - - position.X += shiftx; - position.Y += shifty; - - bool result = false; - - if (TestBorderCross(position,Cardinals.N)) - result = true; - - if (TestBorderCross(position, Cardinals.S)) - result = true; - - if (TestBorderCross(position, Cardinals.E)) - result = true; - - if (TestBorderCross(position, Cardinals.W)) - result = true; - - // bordercross if position is outside of region - - if (!result) - { - regionHandle = RegionInfo.RegionHandle; - } - else - { - // not in this region, undo the shift! - position.X -= shiftx; - position.Y -= shifty; - } - if (EntityTransferModule != null) { EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f95220d..b059ecf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes { public abstract class SceneBase : IScene { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string LogHeader = "[SCENE]"; #region Events diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d4cbf7d..44c476c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -331,7 +331,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); + Vector3 minScale = new Vector3(Constants.MaximumRegionSize, Constants.MaximumRegionSize, Constants.MaximumRegionSize); Vector3 maxScale = Vector3.Zero; Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); @@ -517,14 +517,14 @@ namespace OpenSim.Region.Framework.Scenes m_scene.CrossPrimGroupIntoNewRegion(val, this, true); // Normalize - if (val.X >= Constants.RegionSize) - val.X -= Constants.RegionSize; - if (val.Y >= Constants.RegionSize) - val.Y -= Constants.RegionSize; + if (val.X >= m_scene.RegionInfo.RegionSizeX) + val.X -= m_scene.RegionInfo.RegionSizeX; + if (val.Y >= m_scene.RegionInfo.RegionSizeY) + val.Y -= m_scene.RegionInfo.RegionSizeY; if (val.X < 0) - val.X += Constants.RegionSize; + val.X += m_scene.RegionInfo.RegionSizeX; if (val.Y < 0) - val.Y += Constants.RegionSize; + val.Y += m_scene.RegionInfo.RegionSizeY; // If it's deleted, crossing was successful if (IsDeleted) @@ -572,9 +572,9 @@ namespace OpenSim.Region.Framework.Scenes } } Vector3 oldp = AbsolutePosition; - val.X = Util.Clamp(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f); - val.Y = Util.Clamp(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f); - val.Z = Util.Clamp(oldp.Z, 0.5f, 4096.0f); + val.X = Util.Clamp(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f); + val.Y = Util.Clamp(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f); + val.Z = Util.Clamp(oldp.Z, 0.5f, Constants.RegionHeight); } } -- cgit v1.1