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. --- OpenSim/Framework/IClientAPI.cs | 2 +- .../Region/ClientStack/LindenUDP/LLClientView.cs | 12 ++---- .../Region/Environment/Interfaces/ILandChannel.cs | 2 + .../Region/Environment/Interfaces/ILandObject.cs | 10 +++++ .../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 +- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +- .../ScriptEngine/XEngine/LSL_ScriptCommands.cs | 2 +- 10 files changed, 87 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0ece1a3..11cc166 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -972,7 +972,7 @@ namespace OpenSim.Framework void sendEstateCovenantInformation(); void sendDetailedEstateData(LLUUID invoice,string estateName, uint estateID); - void sendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int simObjectCapacity, uint regionFlags); + void sendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags); void sendLandAccessListData(List avatars, uint accessFlag, int localLandID); void sendForceClientSelectObjects(List objectIDs); void sendLandObjectOwners(Dictionary ownersAndCount); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6839896..47a9f53 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2630,7 +2630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP this.OutPacket(packet, ThrottleOutPacketType.Task); } - 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) { ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); // TODO: don't create new blocks if recycling an old packet @@ -2654,10 +2654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updatePacket.ParcelData.LocalID = landData.localID; if (landData.area > 0) { - updatePacket.ParcelData.MaxPrims = - Convert.ToInt32( - Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * simObjectCapacity * - Convert.ToDecimal(simObjectBonusFactor))); + updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; } else { @@ -2696,10 +2693,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updatePacket.ParcelData.SequenceID = sequence_id; if (landData.simwideArea > 0) { - updatePacket.ParcelData.SimWideMaxPrims = - Convert.ToInt32( - Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * simObjectCapacity * - Convert.ToDecimal(simObjectBonusFactor))); + updatePacket.ParcelData.SimWideMaxPrims = parcelObjectCapacity; } else { diff --git a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs index 6c53177..c1f6f45 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs @@ -42,5 +42,7 @@ namespace OpenSim.Region.Environment.Interfaces bool IsForcefulBansAllowed(); void UpdateLandObject(int localID, LandData data); void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient); + void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); + void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); } } diff --git a/OpenSim/Region/Environment/Interfaces/ILandObject.cs b/OpenSim/Region/Environment/Interfaces/ILandObject.cs index 4368493..750b387 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandObject.cs @@ -32,8 +32,14 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Interfaces { + public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); + public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); + public interface ILandObject { + int getParcelMaxPrimCount(ILandObject thisObject); + int getSimulatorMaxPrimCount(ILandObject thisObject); + LandData landData { get; set; } bool[,] landBitmap { get; set; } LLUUID regionUUID { get; } @@ -57,6 +63,7 @@ namespace OpenSim.Region.Environment.Interfaces void forceUpdateLandInfo(); void setLandBitmap(bool[,] bitmap); + bool[,] basicFullRegionLandBitmap(); bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y); bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value); @@ -69,5 +76,8 @@ namespace OpenSim.Region.Environment.Interfaces void addPrimToCount(SceneObjectGroup obj); void removePrimFromCount(SceneObjectGroup obj); void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); + + void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); + void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); } } 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) diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index dcbbc68..99372fe 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -745,7 +745,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - 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) diff --git a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs index 04cb0b2..b18c867 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/LSL_ScriptCommands.cs @@ -5576,7 +5576,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine { m_host.AddScriptLPS(1); NotImplemented("llSetInventoryPermMask"); - } + } public string llGetInventoryCreator(string item) { -- cgit v1.1