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!
user_profiles
Justin Clark-Casey (justincc) 2013-04-06 02:34:51 +01:00
parent 0f008d5f7d
commit 7f070236f7
4 changed files with 75 additions and 52 deletions

View File

@ -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);

View File

@ -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;

View File

@ -5361,12 +5361,12 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> 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<Vector3> offsets = new List<Vector3>();

View File

@ -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<RegionData> RegionConnections;
@ -75,40 +77,51 @@ public class RegionCombinerLargeLandChannel : ILandChannel
public ILandObject GetLandObject(int x, int y)
{
//m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
return GetLandObject((float)x, (float)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;
}
// 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()