find parcels by GlobalID.. well most time

0.9.0-post-fixes
UbitUmarov 2017-05-13 20:21:56 +01:00
parent dd0269df48
commit 25ca8695f3
5 changed files with 65 additions and 12 deletions

View File

@ -76,6 +76,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns></returns> /// <returns></returns>
ILandObject GetLandObject(int localID); ILandObject GetLandObject(int localID);
ILandObject GetLandObject(UUID GlobalID);
/// <summary> /// <summary>
/// Clear the land channel of all parcels. /// Clear the land channel of all parcels.
/// </summary> /// </summary>

View File

@ -120,6 +120,9 @@ namespace OpenSim.Region.CoreModules.World.Land
public int GetDwell(UUID parcelID) public int GetDwell(UUID parcelID)
{ {
ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID);
if (parcel != null && parcel.LandData != null)
return (int)parcel.LandData.Dwell;
return 0; return 0;
} }
} }

View File

@ -106,6 +106,15 @@ namespace OpenSim.Region.CoreModules.World.Land
return null; return null;
} }
public ILandObject GetLandObject(UUID GlobalID)
{
if (m_landManagementModule != null)
{
return m_landManagementModule.GetLandObject(GlobalID);
}
return null;
}
public ILandObject GetLandObject(Vector3 position) public ILandObject GetLandObject(Vector3 position)
{ {
return GetLandObject(position.X, position.Y); return GetLandObject(position.X, position.Y);

View File

@ -92,6 +92,7 @@ namespace OpenSim.Region.CoreModules.World.Land
//ubit: removed the readonly so i can move it around //ubit: removed the readonly so i can move it around
private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
private Dictionary<UUID, int> m_landUUIDList = new Dictionary<UUID, int>();
private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
@ -249,7 +250,10 @@ namespace OpenSim.Region.CoreModules.World.Land
lock (m_landList) lock (m_landList)
{ {
if (m_landList.TryGetValue(local_id, out land)) if (m_landList.TryGetValue(local_id, out land))
{
land.LandData = newData; land.LandData = newData;
m_landUUIDList[newData.GlobalID] = local_id;
}
} }
if (land != null) if (land != null)
@ -271,6 +275,7 @@ namespace OpenSim.Region.CoreModules.World.Land
lock (m_landList) lock (m_landList)
{ {
m_landList.Clear(); m_landList.Clear();
m_landUUIDList.Clear();
m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 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_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
@ -434,6 +439,15 @@ namespace OpenSim.Region.CoreModules.World.Land
if (parcelAvatarIsEntering != null && if (parcelAvatarIsEntering != null &&
avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID) avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID)
{ {
if(!avatar.IsNPC && avatar.currentParcelUUID != UUID.Zero)
{
ILandObject last = GetLandObject(avatar.currentParcelUUID);
if(last != null)
{
}
}
SendLandUpdate(avatar, parcelAvatarIsEntering); SendLandUpdate(avatar, parcelAvatarIsEntering);
avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID; avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID;
EnforceBans(parcelAvatarIsEntering, avatar); EnforceBans(parcelAvatarIsEntering, avatar);
@ -656,6 +670,7 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
m_landList.Add(newLandLocalID, new_land); m_landList.Add(newLandLocalID, new_land);
m_landUUIDList[new_land.LandData.GlobalID] = newLandLocalID;
m_lastLandLocalID++; m_lastLandLocalID++;
} }
@ -690,6 +705,8 @@ namespace OpenSim.Region.CoreModules.World.Land
land = m_landList[local_id]; land = m_landList[local_id];
m_landList.Remove(local_id); m_landList.Remove(local_id);
if(land.LandData != null)
m_landUUIDList.Remove(land.LandData.GlobalID);
} }
m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID);
@ -745,6 +762,24 @@ namespace OpenSim.Region.CoreModules.World.Land
UpdateLandObject(master.LandData.LocalID, master.LandData); UpdateLandObject(master.LandData.LocalID, master.LandData);
} }
public ILandObject GetLandObject(UUID globalID)
{
lock (m_landList)
{
int lid = -1;
if(m_landUUIDList.TryGetValue(globalID, out lid) && lid >= 0)
{
if (m_landList.ContainsKey(lid))
{
return m_landList[lid];
}
else
m_landUUIDList.Remove(globalID); // auto heal
}
}
return null;
}
public ILandObject GetLandObject(int parcelLocalID) public ILandObject GetLandObject(int parcelLocalID)
{ {
lock (m_landList) lock (m_landList)
@ -1351,7 +1386,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client)
{ {
ILandObject land; ILandObject land = null;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(local_id, out land); m_landList.TryGetValue(local_id, out land);
@ -1360,7 +1395,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (land != null) if (land != null)
{ {
m_scene.EventManager.TriggerParcelPrimCountUpdate(); m_scene.EventManager.TriggerParcelPrimCountUpdate();
m_landList[local_id].SendLandObjectOwners(remote_client); land.SendLandObjectOwners(remote_client);
} }
else else
{ {
@ -1370,7 +1405,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client) public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client)
{ {
ILandObject land; ILandObject land = null;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(local_id, out land); m_landList.TryGetValue(local_id, out land);
@ -1393,7 +1428,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client) public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client)
{ {
ILandObject land; ILandObject land = null;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(local_id, out land); m_landList.TryGetValue(local_id, out land);
@ -1417,7 +1452,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client) public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client)
{ {
ILandObject land; ILandObject land = null;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(local_id, out land); m_landList.TryGetValue(local_id, out land);
@ -1503,17 +1538,16 @@ namespace OpenSim.Region.CoreModules.World.Land
void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client)
{ {
ILandObject land; ILandObject land = null;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(parcelLocalID, out land); m_landList.TryGetValue(parcelLocalID, out land);
} }
if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land))
return;
if (land != null) if (land != null)
{ {
if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land))
return;
land.DeedToGroup(groupID); land.DeedToGroup(groupID);
} }
} }
@ -1763,7 +1797,7 @@ namespace OpenSim.Region.CoreModules.World.Land
land_update.GroupAVSounds = true; land_update.GroupAVSounds = true;
} }
ILandObject land; ILandObject land = null;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(parcelID, out land); m_landList.TryGetValue(parcelID, out land);
@ -1951,7 +1985,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
{ {
ILandObject land; ILandObject land = null;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(localID, out land); m_landList.TryGetValue(localID, out land);
@ -2248,7 +2282,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId)) if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId))
return; return;
ILandObject lo; ILandObject lo = null;
lock (m_landList) lock (m_landList)
{ {

View File

@ -96,6 +96,11 @@ namespace OpenSim.Tests.Common
return GetNoLand(); return GetNoLand();
} }
public ILandObject GetLandObject(UUID ID)
{
return GetNoLand();
}
public ILandObject GetLandObject(float x, float y) public ILandObject GetLandObject(float x, float y)
{ {
return GetNoLand(); return GetNoLand();