From 7f070236f72058ba22d017048b978adea380f0a1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Apr 2013 02:34:51 +0100 Subject: Fix taking (and rezzing) of coalesced objects in the non-root subregions of megaregions. This fixes the combined bounding box location for regions bigger than 256x256. It also fixes the position on taking coalesced objects in the non-root regions, where position checks are properly done on rez instead. It also fixes the megaregion land channel to return null if the land does not exist, which should probably also be done for the ordinary land channels rather than returning a dummy region. Inspiration from Garmin's commit in http://opensimulator.org/mantis/view.php?id=6595. Thanks! --- .../InventoryAccess/InventoryAccessModule.cs | 32 ++++----- .../World/Permissions/PermissionsModule.cs | 2 + OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++-- .../RegionCombinerLargeLandChannel.cs | 83 ++++++++++++++-------- 4 files changed, 76 insertions(+), 53 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index ebada5a..f796ec9 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -357,19 +357,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess foreach (SceneObjectGroup objectGroup in objlist) { - Vector3 inventoryStoredPosition = new Vector3 - (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : objectGroup.AbsolutePosition.X) - , - (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) - ? 250 - : objectGroup.AbsolutePosition.Y, - objectGroup.AbsolutePosition.Z); - - originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; - - objectGroup.AbsolutePosition = inventoryStoredPosition; +// Vector3 inventoryStoredPosition = new Vector3 +// (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) +// ? 250 +// : objectGroup.AbsolutePosition.X) +// , +// (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) +// ? 250 +// : objectGroup.AbsolutePosition.Y, +// objectGroup.AbsolutePosition.Z); +// +// originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; +// +// objectGroup.AbsolutePosition = inventoryStoredPosition; // Make sure all bits but the ones we want are clear // on take. @@ -397,9 +397,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess else itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment); - // Restore the position of each group now that it has been stored to inventory. - foreach (SceneObjectGroup objectGroup in objlist) - objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; +// // Restore the position of each group now that it has been stored to inventory. +// foreach (SceneObjectGroup objectGroup in objlist) +// objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 79dd4a0..77299be 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -1453,6 +1453,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions bool permission = false; + m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name); + ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); if (land == null) return false; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 911a3e4..f50d3cd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5361,12 +5361,12 @@ namespace OpenSim.Region.Framework.Scenes List objects, out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) { - minX = 256; - maxX = -256; - minY = 256; - maxY = -256; - minZ = 8192; - maxZ = -256; + minX = float.MaxValue; + maxX = float.MinValue; + minY = float.MaxValue; + maxY = float.MinValue; + minZ = float.MaxValue; + maxZ = float.MinValue; List offsets = new List(); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index b4abc1d..4bf2a82 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -27,6 +27,8 @@ using System; using System.Collections.Generic; +using System.Reflection; +using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -34,10 +36,10 @@ using OpenSim.Region.CoreModules.World.Land; namespace OpenSim.Region.RegionCombinerModule { -public class RegionCombinerLargeLandChannel : ILandChannel + public class RegionCombinerLargeLandChannel : ILandChannel { - // private static readonly ILog m_log = - // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private RegionData RegData; private ILandChannel RootRegionLandChannel; private readonly List RegionConnections; @@ -75,40 +77,51 @@ public class RegionCombinerLargeLandChannel : ILandChannel public ILandObject GetLandObject(int x, int y) { - //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y); - - if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) - { - return RootRegionLandChannel.GetLandObject(x, y); - } - else - { - int offsetX = (x / (int)Constants.RegionSize); - int offsetY = (y / (int)Constants.RegionSize); - offsetX *= (int)Constants.RegionSize; - offsetY *= (int)Constants.RegionSize; - - foreach (RegionData regionData in RegionConnections) - { - if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) - { - return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); - } - } - ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); - obj.LandData.Name = "NO LAND"; - return obj; - } + return GetLandObject((float)x, (float)y); + +// m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y); +// +// if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) +// { +// return RootRegionLandChannel.GetLandObject(x, y); +// } +// else +// { +// int offsetX = (x / (int)Constants.RegionSize); +// int offsetY = (y / (int)Constants.RegionSize); +// offsetX *= (int)Constants.RegionSize; +// offsetY *= (int)Constants.RegionSize; +// +// foreach (RegionData regionData in RegionConnections) +// { +// if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) +// { +// m_log.DebugFormat( +// "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}", +// regionData.RegionScene.Name, offsetX, offsetY); +// +// return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); +// } +// } +// //ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); +// //obj.LandData.Name = "NO LAND"; +// //return obj; +// } +// +// m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y); +// +// return null; } public ILandObject GetLandObject(int localID) { + // XXX: Possibly should be looking in every land channel, not just the root. return RootRegionLandChannel.GetLandObject(localID); } public ILandObject GetLandObject(float x, float y) { - //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y); +// m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y); if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) { @@ -125,14 +138,22 @@ public class RegionCombinerLargeLandChannel : ILandChannel { if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) { +// m_log.DebugFormat( +// "[REGION COMBINER LARGE LAND CHANNEL]: Found region {0} at offset {1},{2}", +// regionData.RegionScene.Name, offsetX, offsetY); + return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); } } - ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); - obj.LandData.Name = "NO LAND"; - return obj; +// ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); +// obj.LandData.Name = "NO LAND"; +// return obj; } + +// m_log.DebugFormat("[REGION COMBINER LARGE LAND CHANNEL]: No region found at {0},{1}, returning null", x, y); + + return null; } public bool IsForcefulBansAllowed() -- cgit v1.1