|
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
}
|
|
|
|
|
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LandManagementModule")]
|
|
|
- public class LandManagementModule : INonSharedRegionModule
|
|
|
+ public class LandManagementModule : INonSharedRegionModule , ILandChannel
|
|
|
{
|
|
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
private static readonly string LogHeader = "[LAND MANAGEMENT MODULE]";
|
|
@@ -75,8 +75,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
|
|
|
public const int LandUnit = 4;
|
|
|
|
|
|
- private LandChannel landChannel;
|
|
|
private Scene m_scene;
|
|
|
+ //private LandChannel m_landChannel;
|
|
|
+
|
|
|
+ private ulong m_regionHandler;
|
|
|
+ private int m_regionSizeX;
|
|
|
+ private int m_regionSizeY;
|
|
|
|
|
|
protected IGroupsModule m_groupManager;
|
|
|
protected IUserManagement m_userManager;
|
|
@@ -91,11 +95,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
/// <value>
|
|
|
/// Land objects keyed by local id
|
|
|
/// </value>
|
|
|
-// private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
|
|
|
|
|
|
- //ubit: removed the readonly so i can move it around
|
|
|
- private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
|
|
|
- private Dictionary<UUID, int> m_landUUIDList = new Dictionary<UUID, int>();
|
|
|
+ private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
|
|
|
+ private readonly Dictionary<UUID, int> m_landGlobalIDs = new Dictionary<UUID, int>();
|
|
|
+ private readonly Dictionary<UUID, int> m_landFakeIDs = new Dictionary<UUID, int>();
|
|
|
|
|
|
private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
|
|
|
|
|
@@ -161,9 +164,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
public void AddRegion(Scene scene)
|
|
|
{
|
|
|
m_scene = scene;
|
|
|
- m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
|
|
|
+ m_regionHandler = m_scene.RegionInfo.RegionHandle;
|
|
|
+ m_regionSizeX = (int)m_scene.RegionInfo.RegionSizeX;
|
|
|
+ m_regionSizeY = (int)m_scene.RegionInfo.RegionSizeY;
|
|
|
+ m_landIDList = new int[m_regionSizeX / LandUnit, m_regionSizeY / LandUnit];
|
|
|
|
|
|
- landChannel = new LandChannel(scene, this);
|
|
|
+ //m_landChannel = new LandChannel(scene, this);
|
|
|
|
|
|
m_scene.EventManager.OnObjectAddedToScene += EventManagerOnParcelPrimCountAdd;
|
|
|
m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
|
|
@@ -186,7 +192,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
|
|
|
lock (m_scene)
|
|
|
{
|
|
|
- m_scene.LandChannel = (ILandChannel)landChannel;
|
|
|
+ //m_scene.LandChannel = m_landChannel;
|
|
|
+ m_scene.LandChannel = this;
|
|
|
}
|
|
|
|
|
|
RegisterCommands();
|
|
@@ -268,8 +275,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
{
|
|
|
if (m_landList.TryGetValue(local_id, out land))
|
|
|
{
|
|
|
+ m_landGlobalIDs.Remove(land.LandData.GlobalID);
|
|
|
+ if (land.LandData.FakeID != UUID.Zero)
|
|
|
+ m_landFakeIDs.Remove(land.LandData.FakeID);
|
|
|
land.LandData = newData;
|
|
|
- m_landUUIDList[newData.GlobalID] = local_id;
|
|
|
+ m_landGlobalIDs[newData.GlobalID] = local_id;
|
|
|
+ if (newData.FakeID != UUID.Zero)
|
|
|
+ m_landFakeIDs[newData.FakeID] = local_id;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -277,6 +289,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
|
|
|
}
|
|
|
|
|
|
+ public bool IsForcefulBansAllowed()
|
|
|
+ {
|
|
|
+ return AllowedForcefulBans;
|
|
|
+ }
|
|
|
+
|
|
|
public bool AllowedForcefulBans
|
|
|
{
|
|
|
get { return m_allowedForcefulBans; }
|
|
@@ -295,10 +312,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
parcel.Clear();
|
|
|
|
|
|
m_landList.Clear();
|
|
|
- m_landUUIDList.Clear();
|
|
|
+ m_landGlobalIDs.Clear();
|
|
|
+ m_landFakeIDs.Clear();
|
|
|
m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
|
|
|
|
|
|
- m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
|
|
|
+ m_landIDList = new int[m_regionSizeX / LandUnit, m_regionSizeY / LandUnit];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -312,8 +330,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
|
|
|
ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
|
|
|
|
|
|
- fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
|
|
|
- (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
|
|
|
+ fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, m_regionSizeX, m_regionSizeY));
|
|
|
LandData ldata = fullSimParcel.LandData;
|
|
|
ldata.SimwideArea = ldata.Area;
|
|
|
ldata.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
|
@@ -795,9 +812,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
m_landList.Add(newLandLocalID, new_land);
|
|
|
- m_landUUIDList[new_land.LandData.GlobalID] = newLandLocalID;
|
|
|
+ m_landGlobalIDs[new_land.LandData.GlobalID] = newLandLocalID;
|
|
|
+ m_landFakeIDs[new_land.LandData.FakeID] = newLandLocalID;
|
|
|
m_lastLandLocalID++;
|
|
|
}
|
|
|
|
|
@@ -836,7 +854,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
if(land != null && land.LandData != null)
|
|
|
{
|
|
|
landGlobalID = land.LandData.GlobalID;
|
|
|
- m_landUUIDList.Remove(landGlobalID);
|
|
|
+ m_landGlobalIDs.Remove(landGlobalID);
|
|
|
+ m_landFakeIDs.Remove(land.LandData.FakeID);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -857,7 +876,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
lock (m_landList)
|
|
|
{
|
|
|
landworkList = m_landList;
|
|
|
- m_landList = new Dictionary<int, ILandObject>();
|
|
|
+ m_landList.Clear();
|
|
|
}
|
|
|
|
|
|
// this 2 methods have locks (now)
|
|
@@ -873,7 +892,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
|
|
|
}
|
|
|
landworkList.Clear();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void performFinalLandJoin(ILandObject master, ILandObject slave)
|
|
@@ -902,19 +920,44 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
lock (m_landList)
|
|
|
{
|
|
|
int lid = -1;
|
|
|
- if(m_landUUIDList.TryGetValue(globalID, out lid) && lid >= 0)
|
|
|
+ if (m_landGlobalIDs.TryGetValue(globalID, out lid) && lid >= 0)
|
|
|
{
|
|
|
if (m_landList.ContainsKey(lid))
|
|
|
{
|
|
|
return m_landList[lid];
|
|
|
}
|
|
|
else
|
|
|
- m_landUUIDList.Remove(globalID); // auto heal
|
|
|
+ m_landGlobalIDs.Remove(globalID); // auto heal
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ public ILandObject GetLandObjectByfakeID(UUID fakeID)
|
|
|
+ {
|
|
|
+ lock (m_landList)
|
|
|
+ {
|
|
|
+ int lid = -1;
|
|
|
+ if (m_landFakeIDs.TryGetValue(fakeID, out lid) && lid >= 0)
|
|
|
+ {
|
|
|
+ if (m_landList.ContainsKey(lid))
|
|
|
+ {
|
|
|
+ return m_landList[lid];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ m_landFakeIDs.Remove(fakeID); // auto heal
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(Util.ParseFakeParcelID(fakeID, out ulong rhandle, out uint x, out uint y) && rhandle == m_regionHandler)
|
|
|
+ {
|
|
|
+ ILandObject ret = GetLandObjectClipedXY(x, y);
|
|
|
+ if(ret != null)
|
|
|
+ m_landFakeIDs[fakeID] = ret.LandData.LocalID;
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
public ILandObject GetLandObject(int parcelLocalID)
|
|
|
{
|
|
|
lock (m_landList)
|
|
@@ -938,6 +981,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
return GetLandObject((int)x_float, (int)y_float, true);
|
|
|
}
|
|
|
|
|
|
+ public ILandObject GetLandObject(Vector3 position)
|
|
|
+ {
|
|
|
+ return GetLandObject(position.X, position.Y);
|
|
|
+ }
|
|
|
+
|
|
|
// if x,y is off region this will return the parcel at cliped x,y
|
|
|
// as did code it replaces
|
|
|
public ILandObject GetLandObjectClipedXY(float x, float y)
|
|
@@ -946,14 +994,14 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
int avx = (int)x;
|
|
|
if (avx < 0)
|
|
|
avx = 0;
|
|
|
- else if (avx >= m_scene.RegionInfo.RegionSizeX)
|
|
|
- avx = (int)Constants.RegionSize - 1;
|
|
|
+ else if (avx >= m_regionSizeX)
|
|
|
+ avx = m_regionSizeX - 1;
|
|
|
|
|
|
int avy = (int)y;
|
|
|
if (avy < 0)
|
|
|
avy = 0;
|
|
|
- else if (avy >= m_scene.RegionInfo.RegionSizeY)
|
|
|
- avy = (int)Constants.RegionSize - 1;
|
|
|
+ else if (avy >= m_regionSizeY)
|
|
|
+ avy = m_regionSizeY - 1;
|
|
|
|
|
|
lock (m_landIDList)
|
|
|
{
|
|
@@ -977,7 +1025,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
|
|
|
public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
|
|
|
{
|
|
|
- if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
|
|
|
+ if (x >= m_regionSizeX || y >= m_regionSizeY || x < 0 || y < 0)
|
|
|
{
|
|
|
// These exceptions here will cause a lot of complaints from the users specifically because
|
|
|
// they happen every time at border crossings
|
|
@@ -1021,6 +1069,21 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public ILandObject GetLandObjectinLandUnitsInt(int x, int y)
|
|
|
+ {
|
|
|
+ lock (m_landIDList)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ return m_landList[m_landIDList[x, y]];
|
|
|
+ }
|
|
|
+ catch (IndexOutOfRangeException)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public int GetLandObjectIDinLandUnits(int x, int y)
|
|
|
{
|
|
|
lock (m_landIDList)
|
|
@@ -1042,7 +1105,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)];
|
|
|
|
|
|
for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
|
|
|
- for (int yy = 0; yy < m_landIDList.GetLength(0); yy++)
|
|
|
+ for (int yy = 0; yy < m_landIDList.GetLength(1); yy++)
|
|
|
if (m_landIDList[xx, yy] == landID)
|
|
|
ret[xx, yy] = true;
|
|
|
|
|
@@ -1319,6 +1382,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
|
|
|
#region Parcel Updating
|
|
|
|
|
|
+ //legacy name
|
|
|
+ public void SendParcelsOverlay(IClientAPI client)
|
|
|
+ {
|
|
|
+ SendParcelsOverlay(client);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Send the parcel overlay blocks to the client.
|
|
|
/// </summary>
|
|
@@ -1337,12 +1406,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
int byteArrayCount = 0;
|
|
|
int sequenceID = 0;
|
|
|
|
|
|
- int sx = (int)m_scene.RegionInfo.RegionSizeX / LandUnit;
|
|
|
+ int sx = m_regionSizeX / LandUnit;
|
|
|
byte curByte;
|
|
|
byte tmpByte;
|
|
|
|
|
|
// Layer data is in LandUnit (4m) chunks
|
|
|
- for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / LandUnit; ++y)
|
|
|
+ for (int y = 0; y < m_regionSizeY / LandUnit; ++y)
|
|
|
{
|
|
|
for (int x = 0; x < sx;)
|
|
|
{
|
|
@@ -1471,13 +1540,35 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
|
|
|
bool snap_selection, IClientAPI remote_client)
|
|
|
{
|
|
|
+ if (m_landList.Count == 0 || m_landIDList == null)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (start_x < 0 || start_y < 0 || end_x < 0 || end_y < 0)
|
|
|
+ return;
|
|
|
+ if (start_x >= m_regionSizeX || start_y >= m_regionSizeX || end_x >= m_regionSizeY || end_y >= m_regionSizeY)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (end_x - start_x <= LandUnit &&
|
|
|
+ end_y - start_y <= LandUnit)
|
|
|
+ {
|
|
|
+ ILandObject parcel = GetLandObject(start_x, start_y);
|
|
|
+ if(parcel != null)
|
|
|
+ parcel.SendLandProperties(sequence_id, snap_selection, LandChannel.LAND_RESULT_SINGLE, remote_client);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ start_x /= LandUnit;
|
|
|
+ start_y /= LandUnit;
|
|
|
+ end_x /= LandUnit;
|
|
|
+ end_y /= LandUnit;
|
|
|
+
|
|
|
//Get the land objects within the bounds
|
|
|
Dictionary<int, ILandObject> temp = new Dictionary<int, ILandObject>();
|
|
|
- for (int x = start_x; x < end_x; x += LandUnit)
|
|
|
+ for (int x = start_x; x < end_x; ++x)
|
|
|
{
|
|
|
- for (int y = start_y; y < end_y; y += LandUnit)
|
|
|
+ for (int y = start_y; y < end_y; ++y)
|
|
|
{
|
|
|
- ILandObject currentParcel = GetLandObject(x, y);
|
|
|
+ ILandObject currentParcel = GetLandObjectinLandUnits(x, y);
|
|
|
|
|
|
if (currentParcel != null)
|
|
|
{
|
|
@@ -1485,7 +1576,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
{
|
|
|
if (!currentParcel.IsBannedFromLand(remote_client.AgentId))
|
|
|
{
|
|
|
- currentParcel.ForceUpdateLandInfo();
|
|
|
temp[currentParcel.LandData.LocalID] = currentParcel;
|
|
|
}
|
|
|
}
|
|
@@ -1752,9 +1842,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
IncomingLandObjectFromStorage(data[i]);
|
|
|
|
|
|
// Layer data is in LandUnit (4m) chunks
|
|
|
- for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
|
|
|
+ for (int y = 0; y < m_regionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
|
|
|
{
|
|
|
- for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
|
|
|
+ for (int x = 0; x < m_regionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
|
|
|
{
|
|
|
if (m_landIDList[x, y] == 0)
|
|
|
{
|
|
@@ -2216,7 +2306,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending");
|
|
|
}
|
|
|
|
|
|
- public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
|
|
|
+ public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
|
|
|
{
|
|
|
ILandObject land = null;
|
|
|
lock (m_landList)
|
|
@@ -2479,6 +2569,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void ClearAllEnvironments()
|
|
|
+ {
|
|
|
+ List<ILandObject> parcels = AllParcels();
|
|
|
+ for (int i = 0; i < parcels.Count; ++i)
|
|
|
+ parcels[i].StoreEnvironment(null);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
|
|
|
/// </summary>
|
|
@@ -2490,7 +2587,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|
|
public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
|
|
|
{
|
|
|
// Let's find the parcel in question
|
|
|
- ILandObject land = landChannel.GetLandObject(position);
|
|
|
+ ILandObject land = GetLandObject(position);
|
|
|
if (land == null || m_scene.GridUserService == null)
|
|
|
{
|
|
|
m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
|