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! --- .../RegionCombinerLargeLandChannel.cs | 83 ++++++++++++++-------- 1 file changed, 52 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule') 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