aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs49
1 files changed, 36 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs
index 6e87a1c..da42c21 100644
--- a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs
+++ b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs
@@ -772,19 +772,28 @@ namespace OpenSim.Region.Environment.Modules.LandManagement
772 } 772 }
773 } 773 }
774 774
775 /// <summary>
776 /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes
777 /// aggreagete details such as the number of prims.
778 ///
779 /// </summary>
780 /// <param name="remote_client">
781 /// A <see cref="IClientAPI"/>
782 /// </param>
775 public void sendLandObjectOwners(IClientAPI remote_client) 783 public void sendLandObjectOwners(IClientAPI remote_client)
776 { 784 {
777 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); 785 Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>();
778 ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); 786 ParcelObjectOwnersReplyPacket pack
787 = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
779 // TODO: don't create new blocks if recycling an old packet 788 // TODO: don't create new blocks if recycling an old packet
780 789
781 foreach (SceneObjectGroup obj in primsOverMe) 790 foreach (SceneObjectGroup obj in primsOverMe)
782 { 791 {
783 try 792 try
784 { 793 {
785 if (!ownersAndCount.ContainsKey(obj.OwnerID)) 794 if (!primCount.ContainsKey(obj.OwnerID))
786 { 795 {
787 ownersAndCount.Add(obj.OwnerID, 0); 796 primCount.Add(obj.OwnerID, 0);
788 } 797 }
789 } 798 }
790 catch (NullReferenceException) 799 catch (NullReferenceException)
@@ -793,36 +802,50 @@ namespace OpenSim.Region.Environment.Modules.LandManagement
793 } 802 }
794 try 803 try
795 { 804 {
796 ownersAndCount[obj.OwnerID] += obj.PrimCount; 805 primCount[obj.OwnerID] += obj.PrimCount;
797 } 806 }
798 catch (KeyNotFoundException) 807 catch (KeyNotFoundException)
799 { 808 {
800 m_log.Error("[LAND]: Unable to match a prim with it's owner."); 809 m_log.Error("[LAND]: Unable to match a prim with it's owner.");
801 } 810 }
802 } 811 }
803 if (ownersAndCount.Count > 0) 812
813 int notifyCount = primCount.Count;
814
815 if (notifyCount > 0)
804 { 816 {
805 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; 817 if (notifyCount > 32)
806
807 if (ownersAndCount.Count < 32)
808 { 818 {
809 dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count]; 819 m_log.InfoFormat(
820 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
821 + " - a developer might want to investigate whether this is a hard limit", 32);
822
823 notifyCount = 32;
810 } 824 }
811 825
826 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
827 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
812 828
813 int num = 0; 829 int num = 0;
814 foreach (LLUUID owner in ownersAndCount.Keys) 830 foreach (LLUUID owner in primCount.Keys)
815 { 831 {
816 dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock(); 832 dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
817 dataBlock[num].Count = ownersAndCount[owner]; 833 dataBlock[num].Count = primCount[owner];
818 dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added 834 dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
819 dataBlock[num].OnlineStatus = true; //TODO: fix me later 835 dataBlock[num].OnlineStatus = true; //TODO: fix me later
820 dataBlock[num].OwnerID = owner; 836 dataBlock[num].OwnerID = owner;
821 837
822 num++; 838 num++;
839
840 if (num >= notifyCount)
841 {
842 break;
843 }
823 } 844 }
845
824 pack.Data = dataBlock; 846 pack.Data = dataBlock;
825 } 847 }
848
826 remote_client.OutPacket(pack, ThrottleOutPacketType.Task); 849 remote_client.OutPacket(pack, ThrottleOutPacketType.Task);
827 } 850 }
828 851