From 0896cb53d4bb9ffb4492a1a5dfdc2749d9117abb Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 11 Jun 2008 17:31:43 +0000 Subject: *Parcel Prim Count Maximums moved to their own functions so modules can override the default method of calculating how many prims a parcel can have. --- .../Environment/Modules/World/Land/LandChannel.cs | 16 ++++++++ .../Modules/World/Land/LandManagementModule.cs | 12 +++++- .../Environment/Modules/World/Land/LandObject.cs | 43 +++++++++++++++++++++- .../Environment/Modules/World/NPC/NPCAvatar.cs | 2 +- 4 files changed, 69 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs index 0b77b23..b83de23 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs @@ -149,6 +149,22 @@ namespace OpenSim.Region.Environment.Modules.World.Land m_landManagementModule.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); } } + + public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) + { + if (m_landManagementModule != null) + { + m_landManagementModule.setParcelObjectMaxOverride(overrideDel); + } + } + + public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) + { + if (m_landManagementModule != null) + { + m_landManagementModule.setSimulatorObjectMaxOverride(overrideDel); + } + } #endregion } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index 1c04796..984bc4e 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -585,7 +585,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land ResetAllLandPrimCounts(); lock (m_scene.Entities) { - foreach (EntityBase obj in m_scene.Entities.Values) + foreach (EntityBase obj in m_scene.Entities.Values) { if (obj != null) { @@ -1048,6 +1048,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land #endregion + public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) + { + foreach (LandObject obj in landList.Values) + { + obj.setParcelObjectMaxOverride(overrideDel); + } + } + public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) + { + } } } \ No newline at end of file diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index f5b1a1d..2ff48cc 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs @@ -116,13 +116,52 @@ namespace OpenSim.Region.Environment.Modules.World.Land return newLand; } - #endregion + + static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; + static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; + + public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) + { + overrideParcelMaxPrimCount = overrideDel; + } + public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) + { + overrideSimulatorMaxPrimCount = overrideDel; + } + public int getParcelMaxPrimCount(ILandObject thisObject) + { + if (overrideParcelMaxPrimCount != null) + { + return overrideParcelMaxPrimCount(thisObject); + } + else + { + //Normal Calculations + return Convert.ToInt32( + Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * + Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); ; + } + } + public int getSimulatorMaxPrimCount(ILandObject thisObject) + { + if (overrideSimulatorMaxPrimCount != null) + { + return overrideSimulatorMaxPrimCount(thisObject); + } + else + { + //Normal Calculations + return m_scene.objectCapacity; + } + } + #endregion + #region Packet Request Handling public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) { - remote_client.sendLandProperties(remote_client, sequence_id, snap_selection, request_result, landData, m_scene.RegionInfo.EstateSettings.objectBonusFactor, m_scene.objectCapacity,(uint) m_scene.RegionInfo.EstateSettings.regionFlags); + remote_client.sendLandProperties(remote_client, sequence_id, snap_selection, request_result, landData, m_scene.RegionInfo.EstateSettings.objectBonusFactor, getParcelMaxPrimCount(this), getSimulatorMaxPrimCount(this), (uint)m_scene.RegionInfo.EstateSettings.regionFlags); } public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client) diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index b8ca482..a64d857 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -748,7 +748,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { } - public void sendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int simObjectCapacity, uint regionFlags) + public void sendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } public void sendLandAccessListData(List avatars, uint accessFlag, int localLandID) -- cgit v1.1