From 6ae04448f73afdca791ea185fdc0e9c062dea87b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Mar 2011 23:05:51 +0000 Subject: [PATCH 1/6] Start using IPrimCounts populated by PrimCountModule instead of LandData counts populated by LandManagementModule. In order to pass ILandObject into IClientAPI.SendLandProperties(), had to push ILandObject and IPrimCounts into OpenSim.Framework from OpenSim.Region.Framework.Interfaces, in order to avoid ci Counts are showing odd behaviour at the moment, this will be addressed shortly. --- .../Client/MXP/ClientStack/MXPClientView.cs | 2 +- .../VWoHTTP/ClientStack/VWHClientView.cs | 2 +- OpenSim/Framework/IClientAPI.cs | 12 +- .../Interfaces => Framework}/ILandChannel.cs | 0 OpenSim/Framework/IPrimCounts.cs | 45 +++++++ .../ClientStack/LindenUDP/LLClientView.cs | 35 ++++-- .../CoreModules/Avatar/Combat/CombatModule.cs | 1 + .../World/Land/LandManagementModule.cs | 2 +- .../CoreModules/World/Land/LandObject.cs | 2 +- .../Examples/SimpleModule/MyNpcCharacter.cs | 2 +- .../Framework/Interfaces/ILandObject.cs | 117 ------------------ .../Framework/Interfaces/IPrimCountModule.cs | 16 +-- .../Server/IRCClientView.cs | 2 +- .../Scripting/Minimodule/LOParcel.cs | 1 + .../OptionalModules/World/NPC/NPCAvatar.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 16 files changed, 89 insertions(+), 154 deletions(-) rename OpenSim/{Region/Framework/Interfaces => Framework}/ILandChannel.cs (100%) create mode 100644 OpenSim/Framework/IPrimCounts.cs delete mode 100644 OpenSim/Region/Framework/Interfaces/ILandObject.cs diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 1d93382e18..93c6c98469 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1252,7 +1252,7 @@ namespace OpenSim.Client.MXP.ClientStack // Need to translate to MXP somehow } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { // Need to translate to MXP somehow } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index f2b58d3c4c..fc27f0198b 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -799,7 +799,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack throw new System.NotImplementedException(); } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index a6be157688..5bf0b7b0a9 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1143,7 +1143,17 @@ namespace OpenSim.Framework void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner); - void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, + /// + /// Send land properties to the client. + /// + /// + /// + /// + /// + /// /param> + /// + /// + void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags); diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs similarity index 100% rename from OpenSim/Region/Framework/Interfaces/ILandChannel.cs rename to OpenSim/Framework/ILandChannel.cs diff --git a/OpenSim/Framework/IPrimCounts.cs b/OpenSim/Framework/IPrimCounts.cs new file mode 100644 index 0000000000..7d362c5741 --- /dev/null +++ b/OpenSim/Framework/IPrimCounts.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public interface IPrimCounts + { + int Owner { get; } + int Group { get; } + int Others { get; } + int Simulator { get; } + IUserPrimCounts Users { get; } + } + + public interface IUserPrimCounts + { + int this[UUID agentID] { get; } + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2c6795fc3e..6138056daf 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4272,8 +4272,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties( + int sequence_id, bool snap_selection, int request_result, ILandObject lo, + float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { + LandData landData = lo.LandData; + ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); updateMessage.AABBMax = landData.AABBMax; @@ -4281,15 +4285,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.Area = landData.Area; updateMessage.AuctionID = landData.AuctionID; updateMessage.AuthBuyerID = landData.AuthBuyerID; - updateMessage.Bitmap = landData.Bitmap; - updateMessage.Desc = landData.Description; updateMessage.Category = landData.Category; updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); updateMessage.ClaimPrice = landData.ClaimPrice; - updateMessage.GroupID = landData.GroupID; - updateMessage.GroupPrims = landData.GroupPrims; + updateMessage.GroupID = landData.GroupID; updateMessage.IsGroupOwned = landData.IsGroupOwned; updateMessage.LandingType = (LandingType) landData.LandingType; updateMessage.LocalID = landData.LocalID; @@ -4310,9 +4311,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.Name = landData.Name; updateMessage.OtherCleanTime = landData.OtherCleanTime; updateMessage.OtherCount = 0; //TODO: Unimplemented - updateMessage.OtherPrims = landData.OtherPrims; - updateMessage.OwnerID = landData.OwnerID; - updateMessage.OwnerPrims = landData.OwnerPrims; + updateMessage.OwnerID = landData.OwnerID; updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; updateMessage.ParcelPrimBonus = simObjectBonusFactor; updateMessage.PassHours = landData.PassHours; @@ -4327,10 +4326,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.RentPrice = 0; updateMessage.RequestResult = (ParcelResult) request_result; - updateMessage.SalePrice = landData.SalePrice; - updateMessage.SelectedPrims = landData.SelectedPrims; + updateMessage.SalePrice = landData.SalePrice; updateMessage.SelfCount = 0; //TODO: Unimplemented updateMessage.SequenceID = sequence_id; + if (landData.SimwideArea > 0) { int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); @@ -4340,12 +4339,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { updateMessage.SimWideMaxPrims = 0; } - updateMessage.SimWideTotalPrims = landData.SimwidePrims; + updateMessage.SnapSelection = snap_selection; updateMessage.SnapshotID = landData.SnapshotID; updateMessage.Status = (ParcelStatus) landData.Status; - updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + - landData.SelectedPrims; updateMessage.UserLocation = landData.UserLocation; updateMessage.UserLookAt = landData.UserLookAt; @@ -4356,6 +4353,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.MediaLoop = landData.MediaLoop; updateMessage.ObscureMusic = landData.ObscureMusic; updateMessage.ObscureMedia = landData.ObscureMedia; + + IPrimCounts pc = lo.PrimCounts; + updateMessage.OwnerPrims = pc.Owner; + updateMessage.GroupPrims = pc.Group; + updateMessage.OtherPrims = pc.Others; + updateMessage.SimWideTotalPrims = pc.Simulator; + + // FIXME: Need to do selected prims once this is reimplemented. + updateMessage.TotalPrims = pc.Owner + pc.Group + pc.Others; + + // TODO: Need to transfer selected prims to new prim count structure. + updateMessage.SelectedPrims = landData.SelectedPrims; try { diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a5fcb493bd..0babeb5140 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using Nini.Config; +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenMetaverse; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d0727d958c..52e3718bc7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -805,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.Land ILandObject landUnderPrim = GetLandObject(position.X, position.Y); if (landUnderPrim != null) { - landUnderPrim.AddPrimToCount(obj); + ((LandObject)landUnderPrim).AddPrimToCount(obj); } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 749bb3d8cd..e7bdb19e56 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Land } remote_client.SendLandProperties(seq_id, - snap_selection, request_result, LandData, + snap_selection, request_result, this, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, GetParcelMaxPrimCount(this), GetSimulatorMaxPrimCount(this), regionFlags); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 41d6628a97..d939329814 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -909,7 +909,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs deleted file mode 100644 index 9c0abdeedc..0000000000 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.Framework.Interfaces -{ - public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); - public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); - - public interface ILandObject - { - int GetParcelMaxPrimCount(ILandObject thisObject); - int GetSimulatorMaxPrimCount(ILandObject thisObject); - int GetPrimsFree(); - - LandData LandData { get; set; } - bool[,] LandBitmap { get; set; } - UUID RegionUUID { get; } - - /// - /// Prim counts for this land object. - /// - IPrimCounts PrimCounts { get; set; } - - /// - /// The start point for the land object. This is the western-most point as one scans land working from - /// north to south. - /// - Vector3 StartPoint { get; } - - /// - /// The end point for the land object. This is the eastern-most point as one scans land working from - /// south to north. - /// - Vector3 EndPoint { get; } - - bool ContainsPoint(int x, int y); - - ILandObject Copy(); - - void SendLandUpdateToAvatarsOverMe(); - - void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client); - void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); - bool IsEitherBannedOrRestricted(UUID avatar); - bool IsBannedFromLand(UUID avatar); - bool IsRestrictedFromLand(UUID avatar); - void SendLandUpdateToClient(IClientAPI remote_client); - void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); - List CreateAccessListArrayByFlag(AccessList flag); - void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); - void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List entries, IClientAPI remote_client); - void UpdateLandBitmapByteArray(); - void SetLandBitmapFromByteArray(); - bool[,] GetLandBitmap(); - 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); - bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); - void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client); - void SendLandObjectOwners(IClientAPI remote_client); - void ReturnObject(SceneObjectGroup obj); - void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); - void ResetLandPrimCounts(); - void AddPrimToCount(SceneObjectGroup obj); - void RemovePrimFromCount(SceneObjectGroup obj); - void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); - - void DeedToGroup(UUID groupID); - - void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); - void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); - - /// - /// Set the media url for this land parcel - /// - /// - void SetMediaUrl(string url); - - /// - /// Set the music url for this land parcel - /// - /// - void SetMusicUrl(string url); - } -} diff --git a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs index 65158e1c80..d63da2e2af 100644 --- a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs @@ -38,18 +38,4 @@ namespace OpenSim.Region.Framework.Interfaces IPrimCounts GetPrimCounts(UUID parcelID); } - - public interface IPrimCounts - { - int Owner { get; } - int Group { get; } - int Others { get; } - int Simulator { get; } - IUserPrimCounts Users { get; } - } - - public interface IUserPrimCounts - { - int this[UUID agentID] { get; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 49382f0f26..821cd4bd33 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1247,7 +1247,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs index 8df020f893..c898da610d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5d44aa1a8c..96760a2721 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -925,7 +925,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } public void SendLandAccessListData(List avatars, uint accessFlag, int localLandID) diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index ebe0a72a87..d1dc17fc9b 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -957,7 +957,7 @@ namespace OpenSim.Tests.Common.Mock { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } From cc8897fcebdc9d3e875c9bf745ecb77678a776e9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 26 Mar 2011 00:34:49 +0000 Subject: [PATCH 2/6] Add test for PCM taint. This currently fails due to unexpected behaviour of SceneGraph.ForEachSOG(). This will be corrected soon. Also adds lots of temproarily debug logging --- OpenSim/Framework/ILandObject.cs | 112 ++++++++++++++++++ .../ClientStack/LindenUDP/LLClientView.cs | 2 + .../CoreModules/World/Land/PrimCountModule.cs | 79 +++++++++--- .../World/Land/Tests/PrimCountModuleTests.cs | 24 +++- 4 files changed, 201 insertions(+), 16 deletions(-) create mode 100644 OpenSim/Framework/ILandObject.cs diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs new file mode 100644 index 0000000000..931e24aebb --- /dev/null +++ b/OpenSim/Framework/ILandObject.cs @@ -0,0 +1,112 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); + public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); + + public interface ILandObject + { + int GetParcelMaxPrimCount(ILandObject thisObject); + int GetSimulatorMaxPrimCount(ILandObject thisObject); + int GetPrimsFree(); + + LandData LandData { get; set; } + bool[,] LandBitmap { get; set; } + UUID RegionUUID { get; } + + /// + /// Prim counts for this land object. + /// + IPrimCounts PrimCounts { get; set; } + + /// + /// The start point for the land object. This is the western-most point as one scans land working from + /// north to south. + /// + Vector3 StartPoint { get; } + + /// + /// The end point for the land object. This is the eastern-most point as one scans land working from + /// south to north. + /// + Vector3 EndPoint { get; } + + bool ContainsPoint(int x, int y); + + ILandObject Copy(); + + void SendLandUpdateToAvatarsOverMe(); + + void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client); + void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); + bool IsEitherBannedOrRestricted(UUID avatar); + bool IsBannedFromLand(UUID avatar); + bool IsRestrictedFromLand(UUID avatar); + void SendLandUpdateToClient(IClientAPI remote_client); + void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); + List CreateAccessListArrayByFlag(AccessList flag); + void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); + void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List entries, IClientAPI remote_client); + void UpdateLandBitmapByteArray(); + void SetLandBitmapFromByteArray(); + bool[,] GetLandBitmap(); + 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); + bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); + void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client); + void SendLandObjectOwners(IClientAPI remote_client); + void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); + void ResetLandPrimCounts(); + void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); + + void DeedToGroup(UUID groupID); + + void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); + void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); + + /// + /// Set the media url for this land parcel + /// + /// + void SetMediaUrl(string url); + + /// + /// Set the music url for this land parcel + /// + /// + void SetMusicUrl(string url); + } +} diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6138056daf..0b6b04dc3b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4276,6 +4276,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { + m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); + LandData landData = lo.LandData; ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 9fd347e371..72115a847c 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -51,8 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { -// private static readonly ILog m_log = -// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -123,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) AddObject(obj); + else + m_log.DebugFormat( + "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", + obj.Name, m_Scene.RegionInfo.RegionName); + } } @@ -133,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) RemoveObject(obj); + else + m_log.DebugFormat( + "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", + obj.Name, m_Scene.RegionInfo.RegionName); } } private void OnParcelPrimCountTainted() { + m_log.DebugFormat( + "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); + lock (m_TaintLock) m_Tainted = true; } @@ -163,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) { -// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} to prim count", obj.Name); + m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); if (obj.IsAttachment) return; @@ -214,10 +225,14 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void RemoveObject(SceneObjectGroup obj) { + m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); } public IPrimCounts GetPrimCounts(UUID parcelID) { + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); + PrimCounts primCounts; lock (m_PrimCounts) @@ -239,7 +254,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetOwnerCount(UUID parcelID) { -// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); + int count = 0; lock (m_TaintLock) { @@ -248,9 +263,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Owner; + count = counts.Owner; } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -260,6 +280,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetGroupCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -267,9 +289,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Group; + count = counts.Group; } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -279,6 +306,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetOthersCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -286,9 +315,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Others; + count = counts.Others; } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -298,6 +332,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetSimulatorCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -308,10 +344,15 @@ namespace OpenSim.Region.CoreModules.World.Land { int val; if (m_SimwideCounts.TryGetValue(owner, out val)) - return val; + count = val; } } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -322,6 +363,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetUserCount(UUID parcelID, UUID userID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -332,16 +375,21 @@ namespace OpenSim.Region.CoreModules.World.Land { int val; if (counts.Users.TryGetValue(userID, out val)) - return val; + count = val; } } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", + userID, parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } // NOTE: This method MUST be called while holding the taint lock! private void Recount() { -// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); + m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); m_OwnerMap.Clear(); m_SimwideCounts.Clear(); @@ -367,6 +415,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (!m_OwnerMap.ContainsKey(k)) m_PrimCounts.Remove(k); } + m_Tainted = false; } } diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index c9d393f4d6..80b28598ab 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -126,6 +126,28 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); - } + } + + /// + /// Test the count is correct after is has been tainted. + /// + [Test] + public void TestTaint() + { + TestHelper.InMethod(); + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); + + m_pcm.TaintPrimCount(); + + Assert.That(pc.Owner, Is.EqualTo(3)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(3)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(3)); + } } } \ No newline at end of file From bfd9cc44b40e64af3c7504d43a15b7e1b44070a0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 26 Mar 2011 02:05:53 +0000 Subject: [PATCH 3/6] When an object is duplicated, add the dupe to the uuid/local id indexes as well as the basic entities list. Added a prim counts test to reinforce this - shift-copy was no incrementing prim count. This will sometime become a basic scene test. New code needs to be refactored so we just call SceneGraph.AddSceneObject(). This will happen in the near future. With this, basic owner prim counts on a single parcel appear to be working fine (with the same previous existing taint calls as used by the land management module). More work to do. --- .../World/Land/Tests/PrimCountModuleTests.cs | 23 ++++++++++++++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 ++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 80b28598ab..dd55f980b8 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -104,6 +104,29 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Simulator, Is.EqualTo(5)); } + /// + /// Test count after a parcel owner owned copied object is added. + /// + [Test] + public void TestCopiedOwnerObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); + m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); + + Assert.That(pc.Owner, Is.EqualTo(6)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(6)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(6)); + } + /// /// Test count after a parcel owner owned object is removed. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1621398bcb..60855b2c36 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -363,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes if (Entities.ContainsKey(sceneObject.UUID)) return false; + +// m_log.DebugFormat( +// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", +// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); SceneObjectPart[] children = sceneObject.Parts; @@ -1798,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) { - //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); +// m_log.DebugFormat( +// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", +// originalPrimID, offset, AgentID); + SceneObjectGroup original = GetGroupByPrim(originalPrimID); if (original != null) { @@ -1829,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes copy.RootPart.SalePrice = 10; } + // FIXME: This section needs to be refactored so that it just calls AddSceneObject() Entities.Add(copy); + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID[copy.UUID] = copy; + + SceneObjectPart[] children = copy.Parts; + + lock (SceneObjectGroupsByFullPartID) + { + SceneObjectGroupsByFullPartID[copy.UUID] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByFullPartID[part.UUID] = copy; + } + + lock (SceneObjectGroupsByLocalPartID) + { + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + } + // PROBABLE END OF FIXME // Since we copy from a source group that is in selected // state, but the copy is shown deselected in the viewer, From 541cd3e8c84d3ccc13525206b1724ee931416a3c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 26 Mar 2011 02:19:28 +0000 Subject: [PATCH 4/6] move total parcel prim calculations into IPrimCounts instead of doing this in LLClientView need to move selected prim counts from LandData/LMM still --- OpenSim/Framework/IPrimCounts.cs | 24 ++++++++++++ .../CoreModules/World/Land/PrimCountModule.cs | 39 +++++++++++++++++++ .../World/Land/Tests/PrimCountModuleTests.cs | 8 +++- 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/IPrimCounts.cs b/OpenSim/Framework/IPrimCounts.cs index 7d362c5741..8ae57fc807 100644 --- a/OpenSim/Framework/IPrimCounts.cs +++ b/OpenSim/Framework/IPrimCounts.cs @@ -31,10 +31,34 @@ namespace OpenSim.Framework { public interface IPrimCounts { + /// + /// Parcel owner owned prims + /// int Owner { get; } + + /// + /// Parcel group owned prims + /// int Group { get; } + + /// + /// Prims owned by others (not parcel owner or parcel group). + /// int Others { get; } + + /// + /// Total prims on the parcel. + /// + int Total { get; } + + /// + /// Prims on the simulator that are owned by the parcel owner, even if they are in other parcels. + /// int Simulator { get; } + + /// + /// Prims per individual users. + /// IUserPrimCounts Users { get; } } diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 72115a847c..2de5c16465 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -324,6 +324,37 @@ namespace OpenSim.Region.CoreModules.World.Land return count; } + + /// + /// Get the total count of owner, group and others prims on the parcel. + /// FIXME: Need to do selected prims once this is reimplemented. + /// + /// + /// + public int GetTotalCount(UUID parcelID) + { + int count = 0; + + lock (m_TaintLock) + { + if (m_Tainted) + Recount(); + + ParcelCounts counts; + if (m_ParcelCounts.TryGetValue(parcelID, out counts)) + { + count = counts.Owner; + count += counts.Group; + count += counts.Others; + } + } + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; + } /// /// Get the number of prims that are in the entire simulator for the owner of this parcel. @@ -457,6 +488,14 @@ namespace OpenSim.Region.CoreModules.World.Land return m_Parent.GetOthersCount(m_ParcelID); } } + + public int Total + { + get + { + return m_Parent.GetTotalCount(m_ParcelID); + } + } public int Simulator { diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index dd55f980b8..58bd841b1c 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -78,9 +78,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); - Assert.That(pc.Simulator, Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(0)); SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); m_scene.AddNewSceneObject(sog, false); @@ -88,6 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(3)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); @@ -99,6 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(5)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(5)); Assert.That(pc.Users[m_userId], Is.EqualTo(5)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(5)); @@ -122,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(6)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(6)); Assert.That(pc.Users[m_userId], Is.EqualTo(6)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(6)); @@ -146,6 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(1)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(1)); Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); @@ -168,6 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(3)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); From b11e3d33f112f4838ca8dde2d217780affbddce4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 26 Mar 2011 02:20:16 +0000 Subject: [PATCH 5/6] add save of LLClientView I forgot from last commit --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0b6b04dc3b..f50637cca5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4360,10 +4360,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.OwnerPrims = pc.Owner; updateMessage.GroupPrims = pc.Group; updateMessage.OtherPrims = pc.Others; - updateMessage.SimWideTotalPrims = pc.Simulator; - - // FIXME: Need to do selected prims once this is reimplemented. - updateMessage.TotalPrims = pc.Owner + pc.Group + pc.Others; + updateMessage.TotalPrims = pc.Total; + updateMessage.SimWideTotalPrims = pc.Simulator; // TODO: Need to transfer selected prims to new prim count structure. updateMessage.SelectedPrims = landData.SelectedPrims; From fe258753a04706a0f760743b410611bb299b0bc1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 29 Mar 2011 23:07:01 +0100 Subject: [PATCH 6/6] disable prim count debug logging temporarily --- .../ClientStack/LindenUDP/LLClientView.cs | 2 +- .../CoreModules/World/Land/PrimCountModule.cs | 68 ++++++++++--------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f50637cca5..8ebcabbc73 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4276,7 +4276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { - m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); +// m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); LandData landData = lo.LandData; diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 2de5c16465..d126b26a43 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -122,10 +122,10 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) AddObject(obj); - else - m_log.DebugFormat( - "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", - obj.Name, m_Scene.RegionInfo.RegionName); +// else +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", +// obj.Name, m_Scene.RegionInfo.RegionName); } } @@ -137,17 +137,17 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) RemoveObject(obj); - else - m_log.DebugFormat( - "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", - obj.Name, m_Scene.RegionInfo.RegionName); +// else +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", +// obj.Name, m_Scene.RegionInfo.RegionName); } } private void OnParcelPrimCountTainted() { - m_log.DebugFormat( - "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); lock (m_TaintLock) m_Tainted = true; @@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) { - m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); +// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); if (obj.IsAttachment) return; @@ -225,13 +225,15 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void RemoveObject(SceneObjectGroup obj) { - m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); +// m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); + + // Currently this is being done by tainting the count instead. } public IPrimCounts GetPrimCounts(UUID parcelID) { - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); PrimCounts primCounts; @@ -266,9 +268,9 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Owner; } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -292,9 +294,9 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Group; } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -318,9 +320,9 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Others; } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -349,9 +351,9 @@ namespace OpenSim.Region.CoreModules.World.Land } } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -379,9 +381,9 @@ namespace OpenSim.Region.CoreModules.World.Land } } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -410,9 +412,9 @@ namespace OpenSim.Region.CoreModules.World.Land } } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", - userID, parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", +// userID, parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -420,7 +422,7 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: This method MUST be called while holding the taint lock! private void Recount() { - m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); +// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); m_OwnerMap.Clear(); m_SimwideCounts.Clear();