From 5a0cb7d37e2491e508e6e37f0c9ee2e8ce6e7957 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 28 Jan 2011 02:34:07 +0000 Subject: Thank you, Goetz, for a patch to fix prim count display in cut regions. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 3 ++- .../CoreModules/World/Land/LandManagementModule.cs | 8 ++++---- .../Region/CoreModules/World/Land/LandObject.cs | 24 +++++++++++++++++----- OpenSim/Region/Framework/Interfaces/ILandObject.cs | 1 + 4 files changed, 26 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5dab1bc..2c6795f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4333,7 +4333,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.SequenceID = sequence_id; if (landData.SimwideArea > 0) { - updateMessage.SimWideMaxPrims = parcelObjectCapacity; + int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); + updateMessage.SimWideMaxPrims = simulatorCapacity; } else { diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index a46be13..893e35c 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -709,7 +709,7 @@ namespace OpenSim.Region.CoreModules.World.Land int x; int y; - if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) + if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) return null; try @@ -751,10 +751,10 @@ namespace OpenSim.Region.CoreModules.World.Land { try { - if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) + //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) return m_landList[m_landIDList[x / 4, y / 4]]; - else - return null; + //else + // return null; } catch (IndexOutOfRangeException) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index b90e307..46c15ed 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -66,6 +66,13 @@ namespace OpenSim.Region.CoreModules.World.Land #region ILandObject Members + public int GetPrimsFree() + { + m_scene.EventManager.TriggerParcelPrimCountUpdate(); + int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims; + return free; + } + public LandData LandData { get { return m_landData; } @@ -141,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// Returns true if the piece of land contains the specified point public bool ContainsPoint(int x, int y) { - if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) + if (x >= 0 && y >= 0 && x < Constants.RegionSize && y < Constants.RegionSize) { return (LandBitmap[x / 4, y / 4] == true); } @@ -183,7 +190,11 @@ namespace OpenSim.Region.CoreModules.World.Land else { // Normal Calculations - return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); + int parcelMax = (int)(((float)LandData.Area / 65536.0f) + * (float)m_scene.RegionInfo.ObjectCapacity + * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); + // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! + return parcelMax; } } public int GetSimulatorMaxPrimCount(ILandObject thisObject) @@ -195,7 +206,9 @@ namespace OpenSim.Region.CoreModules.World.Land else { //Normal Calculations - return m_scene.RegionInfo.ObjectCapacity; + int simMax = (int)(((float)LandData.SimwideArea / 65536.0f) + * (float)m_scene.RegionInfo.ObjectCapacity); + return simMax; } } #endregion @@ -369,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land newData.AuthBuyerID = UUID.Zero; newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); - + m_scene.EventManager.TriggerParcelPrimCountUpdate(); SendLandUpdateToAvatarsOverMe(true); } @@ -384,7 +397,7 @@ namespace OpenSim.Region.CoreModules.World.Land newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); - + m_scene.EventManager.TriggerParcelPrimCountUpdate(); SendLandUpdateToAvatarsOverMe(true); } @@ -450,6 +463,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) { + m_scene.EventManager.TriggerParcelPrimCountUpdate(); SendLandProperties(0, snap_selection, 0, remote_client); } diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs index 576b645..eeb9d3a 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs @@ -39,6 +39,7 @@ namespace OpenSim.Region.Framework.Interfaces { int GetParcelMaxPrimCount(ILandObject thisObject); int GetSimulatorMaxPrimCount(ILandObject thisObject); + int GetPrimsFree(); LandData LandData { get; set; } bool[,] LandBitmap { get; set; } -- cgit v1.1