From a3f2c1276a4e86552aa2112600fe686763d7c5a3 Mon Sep 17 00:00:00 2001 From: mingchen Date: Sat, 14 Jul 2007 15:57:20 +0000 Subject: *Added support for simwide area and simwide prim count for parcels --- OpenSim/Region/Environment/ParcelManager.cs | 51 +++++++++++++++++++++++++++-- OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- 2 files changed, 50 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index 981898f..28bfd4c 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs @@ -548,6 +548,45 @@ namespace OpenSim.Region.Environment { this.parcelPrimCountTainted = true; } + + + + public void finalizeParcelPrimCountUpdate() + { + //Get Simwide prim count for owner + Dictionary> parcelOwnersAndParcels = new Dictionary>(); + foreach (Parcel p in parcelList.Values) + { + if(!parcelOwnersAndParcels.ContainsKey(p.parcelData.ownerID)) + { + List tempList = new List(); + tempList.Add(p); + parcelOwnersAndParcels.Add(p.parcelData.ownerID,tempList); + } + else + { + parcelOwnersAndParcels[p.parcelData.ownerID].Add(p); + } + } + + foreach (LLUUID owner in parcelOwnersAndParcels.Keys) + { + int simArea = 0; + int simPrims = 0; + foreach (Parcel p in parcelOwnersAndParcels[owner]) + { + simArea += p.parcelData.area; + simPrims += p.parcelData.ownerPrims + p.parcelData.otherPrims + p.parcelData.groupPrims; + } + + foreach (Parcel p in parcelOwnersAndParcels[owner]) + { + p.parcelData.simwideArea = simArea; + p.parcelData.simwidePrims = simPrims; + } + } + + } #endregion } #endregion @@ -670,8 +709,15 @@ namespace OpenSim.Region.Environment updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented updatePacket.ParcelData.SelfCount = 0;//unemplemented updatePacket.ParcelData.SequenceID = sequence_id; - updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented - updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented + if (parcelData.simwideArea > 0) + { + updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Floor((Convert.ToDecimal(65536) / Convert.ToDecimal(parcelData.simwideArea)) * 15000)); + } + else + { + updatePacket.ParcelData.SimWideMaxPrims = 0; + } + updatePacket.ParcelData.SimWideTotalPrims = parcelData.simwidePrims; updatePacket.ParcelData.SnapSelection = snap_selection; updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; @@ -1003,6 +1049,7 @@ namespace OpenSim.Region.Environment } } + #endregion diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 13a8c89..9565c02 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -146,7 +146,6 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence.LoadAnims(); - this.performParcelPrimCountUpdate(); this.httpListener = httpServer; } #endregion @@ -827,6 +826,7 @@ namespace OpenSim.Region.Environment.Scenes { m_parcelManager.resetAllParcelPrimCounts(); m_eventManager.TriggerParcelPrimCountUpdate(); + m_parcelManager.finalizeParcelPrimCountUpdate(); m_parcelManager.parcelPrimCountTainted = false; } #endregion -- cgit v1.1