diff options
author | Justin Clark-Casey (justincc) | 2011-03-29 23:08:44 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-03-29 23:08:44 +0100 |
commit | f754dedbef45097910f3977ca22e9afaaaed9196 (patch) | |
tree | 88f2119ec41194436baae80c974795f4083f0944 /OpenSim/Region | |
parent | Improvement over 2 commits ago: make the hyperlink check understand port 80. (diff) | |
parent | disable prim count debug logging temporarily (diff) | |
download | opensim-SC-f754dedbef45097910f3977ca22e9afaaaed9196.zip opensim-SC-f754dedbef45097910f3977ca22e9afaaaed9196.tar.gz opensim-SC-f754dedbef45097910f3977ca22e9afaaaed9196.tar.bz2 opensim-SC-f754dedbef45097910f3977ca22e9afaaaed9196.tar.xz |
Merge branch 'primcounts'
Diffstat (limited to '')
13 files changed, 188 insertions, 55 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 30bae16..30bae16 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs | |||
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 9c0abde..931e24a 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs | |||
@@ -27,10 +27,8 @@ | |||
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | 30 | ||
33 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Framework |
34 | { | 32 | { |
35 | public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); | 33 | public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); |
36 | public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); | 34 | public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); |
@@ -90,11 +88,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
90 | bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); | 88 | bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); |
91 | void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client); | 89 | void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client); |
92 | void SendLandObjectOwners(IClientAPI remote_client); | 90 | void SendLandObjectOwners(IClientAPI remote_client); |
93 | void ReturnObject(SceneObjectGroup obj); | ||
94 | void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); | 91 | void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); |
95 | void ResetLandPrimCounts(); | 92 | void ResetLandPrimCounts(); |
96 | void AddPrimToCount(SceneObjectGroup obj); | ||
97 | void RemovePrimFromCount(SceneObjectGroup obj); | ||
98 | void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); | 93 | void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); |
99 | 94 | ||
100 | void DeedToGroup(UUID groupID); | 95 | void DeedToGroup(UUID groupID); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2c6795f..8ebcabb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -4272,8 +4272,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4272 | OutPacket(packet, ThrottleOutPacketType.Task); | 4272 | OutPacket(packet, ThrottleOutPacketType.Task); |
4273 | } | 4273 | } |
4274 | 4274 | ||
4275 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 4275 | public void SendLandProperties( |
4276 | int sequence_id, bool snap_selection, int request_result, ILandObject lo, | ||
4277 | float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | ||
4276 | { | 4278 | { |
4279 | // m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); | ||
4280 | |||
4281 | LandData landData = lo.LandData; | ||
4282 | |||
4277 | ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); | 4283 | ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); |
4278 | 4284 | ||
4279 | updateMessage.AABBMax = landData.AABBMax; | 4285 | updateMessage.AABBMax = landData.AABBMax; |
@@ -4281,15 +4287,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4281 | updateMessage.Area = landData.Area; | 4287 | updateMessage.Area = landData.Area; |
4282 | updateMessage.AuctionID = landData.AuctionID; | 4288 | updateMessage.AuctionID = landData.AuctionID; |
4283 | updateMessage.AuthBuyerID = landData.AuthBuyerID; | 4289 | updateMessage.AuthBuyerID = landData.AuthBuyerID; |
4284 | |||
4285 | updateMessage.Bitmap = landData.Bitmap; | 4290 | updateMessage.Bitmap = landData.Bitmap; |
4286 | |||
4287 | updateMessage.Desc = landData.Description; | 4291 | updateMessage.Desc = landData.Description; |
4288 | updateMessage.Category = landData.Category; | 4292 | updateMessage.Category = landData.Category; |
4289 | updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); | 4293 | updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); |
4290 | updateMessage.ClaimPrice = landData.ClaimPrice; | 4294 | updateMessage.ClaimPrice = landData.ClaimPrice; |
4291 | updateMessage.GroupID = landData.GroupID; | 4295 | updateMessage.GroupID = landData.GroupID; |
4292 | updateMessage.GroupPrims = landData.GroupPrims; | ||
4293 | updateMessage.IsGroupOwned = landData.IsGroupOwned; | 4296 | updateMessage.IsGroupOwned = landData.IsGroupOwned; |
4294 | updateMessage.LandingType = (LandingType) landData.LandingType; | 4297 | updateMessage.LandingType = (LandingType) landData.LandingType; |
4295 | updateMessage.LocalID = landData.LocalID; | 4298 | updateMessage.LocalID = landData.LocalID; |
@@ -4310,9 +4313,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4310 | updateMessage.Name = landData.Name; | 4313 | updateMessage.Name = landData.Name; |
4311 | updateMessage.OtherCleanTime = landData.OtherCleanTime; | 4314 | updateMessage.OtherCleanTime = landData.OtherCleanTime; |
4312 | updateMessage.OtherCount = 0; //TODO: Unimplemented | 4315 | updateMessage.OtherCount = 0; //TODO: Unimplemented |
4313 | updateMessage.OtherPrims = landData.OtherPrims; | 4316 | updateMessage.OwnerID = landData.OwnerID; |
4314 | updateMessage.OwnerID = landData.OwnerID; | ||
4315 | updateMessage.OwnerPrims = landData.OwnerPrims; | ||
4316 | updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; | 4317 | updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; |
4317 | updateMessage.ParcelPrimBonus = simObjectBonusFactor; | 4318 | updateMessage.ParcelPrimBonus = simObjectBonusFactor; |
4318 | updateMessage.PassHours = landData.PassHours; | 4319 | updateMessage.PassHours = landData.PassHours; |
@@ -4327,10 +4328,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4327 | 4328 | ||
4328 | updateMessage.RentPrice = 0; | 4329 | updateMessage.RentPrice = 0; |
4329 | updateMessage.RequestResult = (ParcelResult) request_result; | 4330 | updateMessage.RequestResult = (ParcelResult) request_result; |
4330 | updateMessage.SalePrice = landData.SalePrice; | 4331 | updateMessage.SalePrice = landData.SalePrice; |
4331 | updateMessage.SelectedPrims = landData.SelectedPrims; | ||
4332 | updateMessage.SelfCount = 0; //TODO: Unimplemented | 4332 | updateMessage.SelfCount = 0; //TODO: Unimplemented |
4333 | updateMessage.SequenceID = sequence_id; | 4333 | updateMessage.SequenceID = sequence_id; |
4334 | |||
4334 | if (landData.SimwideArea > 0) | 4335 | if (landData.SimwideArea > 0) |
4335 | { | 4336 | { |
4336 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4337 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); |
@@ -4340,12 +4341,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4340 | { | 4341 | { |
4341 | updateMessage.SimWideMaxPrims = 0; | 4342 | updateMessage.SimWideMaxPrims = 0; |
4342 | } | 4343 | } |
4343 | updateMessage.SimWideTotalPrims = landData.SimwidePrims; | 4344 | |
4344 | updateMessage.SnapSelection = snap_selection; | 4345 | updateMessage.SnapSelection = snap_selection; |
4345 | updateMessage.SnapshotID = landData.SnapshotID; | 4346 | updateMessage.SnapshotID = landData.SnapshotID; |
4346 | updateMessage.Status = (ParcelStatus) landData.Status; | 4347 | updateMessage.Status = (ParcelStatus) landData.Status; |
4347 | updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + | ||
4348 | landData.SelectedPrims; | ||
4349 | updateMessage.UserLocation = landData.UserLocation; | 4348 | updateMessage.UserLocation = landData.UserLocation; |
4350 | updateMessage.UserLookAt = landData.UserLookAt; | 4349 | updateMessage.UserLookAt = landData.UserLookAt; |
4351 | 4350 | ||
@@ -4356,6 +4355,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4356 | updateMessage.MediaLoop = landData.MediaLoop; | 4355 | updateMessage.MediaLoop = landData.MediaLoop; |
4357 | updateMessage.ObscureMusic = landData.ObscureMusic; | 4356 | updateMessage.ObscureMusic = landData.ObscureMusic; |
4358 | updateMessage.ObscureMedia = landData.ObscureMedia; | 4357 | updateMessage.ObscureMedia = landData.ObscureMedia; |
4358 | |||
4359 | IPrimCounts pc = lo.PrimCounts; | ||
4360 | updateMessage.OwnerPrims = pc.Owner; | ||
4361 | updateMessage.GroupPrims = pc.Group; | ||
4362 | updateMessage.OtherPrims = pc.Others; | ||
4363 | updateMessage.TotalPrims = pc.Total; | ||
4364 | updateMessage.SimWideTotalPrims = pc.Simulator; | ||
4365 | |||
4366 | // TODO: Need to transfer selected prims to new prim count structure. | ||
4367 | updateMessage.SelectedPrims = landData.SelectedPrims; | ||
4359 | 4368 | ||
4360 | try | 4369 | try |
4361 | { | 4370 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a5fcb49..0babeb5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d0727d9..52e3718 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 | |||
805 | ILandObject landUnderPrim = GetLandObject(position.X, position.Y); | 805 | ILandObject landUnderPrim = GetLandObject(position.X, position.Y); |
806 | if (landUnderPrim != null) | 806 | if (landUnderPrim != null) |
807 | { | 807 | { |
808 | landUnderPrim.AddPrimToCount(obj); | 808 | ((LandObject)landUnderPrim).AddPrimToCount(obj); |
809 | } | 809 | } |
810 | } | 810 | } |
811 | 811 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 749bb3d..e7bdb19 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 | |||
243 | } | 243 | } |
244 | 244 | ||
245 | remote_client.SendLandProperties(seq_id, | 245 | remote_client.SendLandProperties(seq_id, |
246 | snap_selection, request_result, LandData, | 246 | snap_selection, request_result, this, |
247 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 247 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
248 | GetParcelMaxPrimCount(this), | 248 | GetParcelMaxPrimCount(this), |
249 | GetSimulatorMaxPrimCount(this), regionFlags); | 249 | GetSimulatorMaxPrimCount(this), regionFlags); |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 9fd347e..d126b26 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 | |||
51 | 51 | ||
52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule | 52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule |
53 | { | 53 | { |
54 | // private static readonly ILog m_log = | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | 55 | ||
57 | private Scene m_Scene; | 56 | private Scene m_Scene; |
58 | private Dictionary<UUID, PrimCounts> m_PrimCounts = | 57 | private Dictionary<UUID, PrimCounts> m_PrimCounts = |
@@ -123,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
123 | { | 122 | { |
124 | if (!m_Tainted) | 123 | if (!m_Tainted) |
125 | AddObject(obj); | 124 | AddObject(obj); |
125 | // else | ||
126 | // m_log.DebugFormat( | ||
127 | // "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", | ||
128 | // obj.Name, m_Scene.RegionInfo.RegionName); | ||
129 | |||
126 | } | 130 | } |
127 | } | 131 | } |
128 | 132 | ||
@@ -133,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
133 | { | 137 | { |
134 | if (!m_Tainted) | 138 | if (!m_Tainted) |
135 | RemoveObject(obj); | 139 | RemoveObject(obj); |
140 | // else | ||
141 | // m_log.DebugFormat( | ||
142 | // "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", | ||
143 | // obj.Name, m_Scene.RegionInfo.RegionName); | ||
136 | } | 144 | } |
137 | } | 145 | } |
138 | 146 | ||
139 | private void OnParcelPrimCountTainted() | 147 | private void OnParcelPrimCountTainted() |
140 | { | 148 | { |
149 | // m_log.DebugFormat( | ||
150 | // "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); | ||
151 | |||
141 | lock (m_TaintLock) | 152 | lock (m_TaintLock) |
142 | m_Tainted = true; | 153 | m_Tainted = true; |
143 | } | 154 | } |
@@ -163,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
163 | // NOTE: Call under Taint Lock | 174 | // NOTE: Call under Taint Lock |
164 | private void AddObject(SceneObjectGroup obj) | 175 | private void AddObject(SceneObjectGroup obj) |
165 | { | 176 | { |
166 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} to prim count", obj.Name); | 177 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); |
167 | 178 | ||
168 | if (obj.IsAttachment) | 179 | if (obj.IsAttachment) |
169 | return; | 180 | return; |
@@ -214,10 +225,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
214 | // NOTE: Call under Taint Lock | 225 | // NOTE: Call under Taint Lock |
215 | private void RemoveObject(SceneObjectGroup obj) | 226 | private void RemoveObject(SceneObjectGroup obj) |
216 | { | 227 | { |
228 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); | ||
229 | |||
230 | // Currently this is being done by tainting the count instead. | ||
217 | } | 231 | } |
218 | 232 | ||
219 | public IPrimCounts GetPrimCounts(UUID parcelID) | 233 | public IPrimCounts GetPrimCounts(UUID parcelID) |
220 | { | 234 | { |
235 | // m_log.DebugFormat( | ||
236 | // "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); | ||
237 | |||
221 | PrimCounts primCounts; | 238 | PrimCounts primCounts; |
222 | 239 | ||
223 | lock (m_PrimCounts) | 240 | lock (m_PrimCounts) |
@@ -239,7 +256,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
239 | /// <returns></returns> | 256 | /// <returns></returns> |
240 | public int GetOwnerCount(UUID parcelID) | 257 | public int GetOwnerCount(UUID parcelID) |
241 | { | 258 | { |
242 | // m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); | 259 | int count = 0; |
243 | 260 | ||
244 | lock (m_TaintLock) | 261 | lock (m_TaintLock) |
245 | { | 262 | { |
@@ -248,9 +265,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
248 | 265 | ||
249 | ParcelCounts counts; | 266 | ParcelCounts counts; |
250 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 267 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
251 | return counts.Owner; | 268 | count = counts.Owner; |
252 | } | 269 | } |
253 | return 0; | 270 | |
271 | // m_log.DebugFormat( | ||
272 | // "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", | ||
273 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
274 | |||
275 | return count; | ||
254 | } | 276 | } |
255 | 277 | ||
256 | /// <summary> | 278 | /// <summary> |
@@ -260,6 +282,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
260 | /// <returns></returns> | 282 | /// <returns></returns> |
261 | public int GetGroupCount(UUID parcelID) | 283 | public int GetGroupCount(UUID parcelID) |
262 | { | 284 | { |
285 | int count = 0; | ||
286 | |||
263 | lock (m_TaintLock) | 287 | lock (m_TaintLock) |
264 | { | 288 | { |
265 | if (m_Tainted) | 289 | if (m_Tainted) |
@@ -267,9 +291,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
267 | 291 | ||
268 | ParcelCounts counts; | 292 | ParcelCounts counts; |
269 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 293 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
270 | return counts.Group; | 294 | count = counts.Group; |
271 | } | 295 | } |
272 | return 0; | 296 | |
297 | // m_log.DebugFormat( | ||
298 | // "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", | ||
299 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
300 | |||
301 | return count; | ||
273 | } | 302 | } |
274 | 303 | ||
275 | /// <summary> | 304 | /// <summary> |
@@ -279,6 +308,35 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
279 | /// <returns></returns> | 308 | /// <returns></returns> |
280 | public int GetOthersCount(UUID parcelID) | 309 | public int GetOthersCount(UUID parcelID) |
281 | { | 310 | { |
311 | int count = 0; | ||
312 | |||
313 | lock (m_TaintLock) | ||
314 | { | ||
315 | if (m_Tainted) | ||
316 | Recount(); | ||
317 | |||
318 | ParcelCounts counts; | ||
319 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | ||
320 | count = counts.Others; | ||
321 | } | ||
322 | |||
323 | // m_log.DebugFormat( | ||
324 | // "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", | ||
325 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
326 | |||
327 | return count; | ||
328 | } | ||
329 | |||
330 | /// <summary> | ||
331 | /// Get the total count of owner, group and others prims on the parcel. | ||
332 | /// FIXME: Need to do selected prims once this is reimplemented. | ||
333 | /// </summary> | ||
334 | /// <param name="parcelID"></param> | ||
335 | /// <returns></returns> | ||
336 | public int GetTotalCount(UUID parcelID) | ||
337 | { | ||
338 | int count = 0; | ||
339 | |||
282 | lock (m_TaintLock) | 340 | lock (m_TaintLock) |
283 | { | 341 | { |
284 | if (m_Tainted) | 342 | if (m_Tainted) |
@@ -286,9 +344,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
286 | 344 | ||
287 | ParcelCounts counts; | 345 | ParcelCounts counts; |
288 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 346 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
289 | return counts.Others; | 347 | { |
348 | count = counts.Owner; | ||
349 | count += counts.Group; | ||
350 | count += counts.Others; | ||
351 | } | ||
290 | } | 352 | } |
291 | return 0; | 353 | |
354 | // m_log.DebugFormat( | ||
355 | // "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", | ||
356 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
357 | |||
358 | return count; | ||
292 | } | 359 | } |
293 | 360 | ||
294 | /// <summary> | 361 | /// <summary> |
@@ -298,6 +365,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
298 | /// <returns></returns> | 365 | /// <returns></returns> |
299 | public int GetSimulatorCount(UUID parcelID) | 366 | public int GetSimulatorCount(UUID parcelID) |
300 | { | 367 | { |
368 | int count = 0; | ||
369 | |||
301 | lock (m_TaintLock) | 370 | lock (m_TaintLock) |
302 | { | 371 | { |
303 | if (m_Tainted) | 372 | if (m_Tainted) |
@@ -308,10 +377,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
308 | { | 377 | { |
309 | int val; | 378 | int val; |
310 | if (m_SimwideCounts.TryGetValue(owner, out val)) | 379 | if (m_SimwideCounts.TryGetValue(owner, out val)) |
311 | return val; | 380 | count = val; |
312 | } | 381 | } |
313 | } | 382 | } |
314 | return 0; | 383 | |
384 | // m_log.DebugFormat( | ||
385 | // "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", | ||
386 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
387 | |||
388 | return count; | ||
315 | } | 389 | } |
316 | 390 | ||
317 | /// <summary> | 391 | /// <summary> |
@@ -322,6 +396,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
322 | /// <returns></returns> | 396 | /// <returns></returns> |
323 | public int GetUserCount(UUID parcelID, UUID userID) | 397 | public int GetUserCount(UUID parcelID, UUID userID) |
324 | { | 398 | { |
399 | int count = 0; | ||
400 | |||
325 | lock (m_TaintLock) | 401 | lock (m_TaintLock) |
326 | { | 402 | { |
327 | if (m_Tainted) | 403 | if (m_Tainted) |
@@ -332,10 +408,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
332 | { | 408 | { |
333 | int val; | 409 | int val; |
334 | if (counts.Users.TryGetValue(userID, out val)) | 410 | if (counts.Users.TryGetValue(userID, out val)) |
335 | return val; | 411 | count = val; |
336 | } | 412 | } |
337 | } | 413 | } |
338 | return 0; | 414 | |
415 | // m_log.DebugFormat( | ||
416 | // "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", | ||
417 | // userID, parcelID, m_Scene.RegionInfo.RegionName, count); | ||
418 | |||
419 | return count; | ||
339 | } | 420 | } |
340 | 421 | ||
341 | // NOTE: This method MUST be called while holding the taint lock! | 422 | // NOTE: This method MUST be called while holding the taint lock! |
@@ -367,6 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
367 | if (!m_OwnerMap.ContainsKey(k)) | 448 | if (!m_OwnerMap.ContainsKey(k)) |
368 | m_PrimCounts.Remove(k); | 449 | m_PrimCounts.Remove(k); |
369 | } | 450 | } |
451 | |||
370 | m_Tainted = false; | 452 | m_Tainted = false; |
371 | } | 453 | } |
372 | } | 454 | } |
@@ -408,6 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
408 | return m_Parent.GetOthersCount(m_ParcelID); | 490 | return m_Parent.GetOthersCount(m_ParcelID); |
409 | } | 491 | } |
410 | } | 492 | } |
493 | |||
494 | public int Total | ||
495 | { | ||
496 | get | ||
497 | { | ||
498 | return m_Parent.GetTotalCount(m_ParcelID); | ||
499 | } | ||
500 | } | ||
411 | 501 | ||
412 | public int Simulator | 502 | public int Simulator |
413 | { | 503 | { |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index c9d393f..58bd841 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 | |||
78 | Assert.That(pc.Owner, Is.EqualTo(0)); | 78 | Assert.That(pc.Owner, Is.EqualTo(0)); |
79 | Assert.That(pc.Group, Is.EqualTo(0)); | 79 | Assert.That(pc.Group, Is.EqualTo(0)); |
80 | Assert.That(pc.Others, Is.EqualTo(0)); | 80 | Assert.That(pc.Others, Is.EqualTo(0)); |
81 | Assert.That(pc.Total, Is.EqualTo(0)); | ||
81 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | 82 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); |
82 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 83 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
83 | Assert.That(pc.Simulator, Is.EqualTo(0)); | 84 | Assert.That(pc.Simulator, Is.EqualTo(0)); |
84 | 85 | ||
85 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); | 86 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); |
86 | m_scene.AddNewSceneObject(sog, false); | 87 | m_scene.AddNewSceneObject(sog, false); |
@@ -88,6 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
88 | Assert.That(pc.Owner, Is.EqualTo(3)); | 89 | Assert.That(pc.Owner, Is.EqualTo(3)); |
89 | Assert.That(pc.Group, Is.EqualTo(0)); | 90 | Assert.That(pc.Group, Is.EqualTo(0)); |
90 | Assert.That(pc.Others, Is.EqualTo(0)); | 91 | Assert.That(pc.Others, Is.EqualTo(0)); |
92 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
91 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | 93 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); |
92 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 94 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
93 | Assert.That(pc.Simulator, Is.EqualTo(3)); | 95 | Assert.That(pc.Simulator, Is.EqualTo(3)); |
@@ -99,12 +101,37 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
99 | Assert.That(pc.Owner, Is.EqualTo(5)); | 101 | Assert.That(pc.Owner, Is.EqualTo(5)); |
100 | Assert.That(pc.Group, Is.EqualTo(0)); | 102 | Assert.That(pc.Group, Is.EqualTo(0)); |
101 | Assert.That(pc.Others, Is.EqualTo(0)); | 103 | Assert.That(pc.Others, Is.EqualTo(0)); |
104 | Assert.That(pc.Total, Is.EqualTo(5)); | ||
102 | Assert.That(pc.Users[m_userId], Is.EqualTo(5)); | 105 | Assert.That(pc.Users[m_userId], Is.EqualTo(5)); |
103 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 106 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
104 | Assert.That(pc.Simulator, Is.EqualTo(5)); | 107 | Assert.That(pc.Simulator, Is.EqualTo(5)); |
105 | } | 108 | } |
106 | 109 | ||
107 | /// <summary> | 110 | /// <summary> |
111 | /// Test count after a parcel owner owned copied object is added. | ||
112 | /// </summary> | ||
113 | [Test] | ||
114 | public void TestCopiedOwnerObject() | ||
115 | { | ||
116 | TestHelper.InMethod(); | ||
117 | // log4net.Config.XmlConfigurator.Configure(); | ||
118 | |||
119 | IPrimCounts pc = m_lo.PrimCounts; | ||
120 | |||
121 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); | ||
122 | m_scene.AddNewSceneObject(sog, false); | ||
123 | m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); | ||
124 | |||
125 | Assert.That(pc.Owner, Is.EqualTo(6)); | ||
126 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
127 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
128 | Assert.That(pc.Total, Is.EqualTo(6)); | ||
129 | Assert.That(pc.Users[m_userId], Is.EqualTo(6)); | ||
130 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | ||
131 | Assert.That(pc.Simulator, Is.EqualTo(6)); | ||
132 | } | ||
133 | |||
134 | /// <summary> | ||
108 | /// Test count after a parcel owner owned object is removed. | 135 | /// Test count after a parcel owner owned object is removed. |
109 | /// </summary> | 136 | /// </summary> |
110 | [Test] | 137 | [Test] |
@@ -123,9 +150,33 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
123 | Assert.That(pc.Owner, Is.EqualTo(1)); | 150 | Assert.That(pc.Owner, Is.EqualTo(1)); |
124 | Assert.That(pc.Group, Is.EqualTo(0)); | 151 | Assert.That(pc.Group, Is.EqualTo(0)); |
125 | Assert.That(pc.Others, Is.EqualTo(0)); | 152 | Assert.That(pc.Others, Is.EqualTo(0)); |
153 | Assert.That(pc.Total, Is.EqualTo(1)); | ||
126 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); | 154 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); |
127 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | 155 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); |
128 | Assert.That(pc.Simulator, Is.EqualTo(1)); | 156 | Assert.That(pc.Simulator, Is.EqualTo(1)); |
129 | } | 157 | } |
158 | |||
159 | /// <summary> | ||
160 | /// Test the count is correct after is has been tainted. | ||
161 | /// </summary> | ||
162 | [Test] | ||
163 | public void TestTaint() | ||
164 | { | ||
165 | TestHelper.InMethod(); | ||
166 | IPrimCounts pc = m_lo.PrimCounts; | ||
167 | |||
168 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); | ||
169 | m_scene.AddNewSceneObject(sog, false); | ||
170 | |||
171 | m_pcm.TaintPrimCount(); | ||
172 | |||
173 | Assert.That(pc.Owner, Is.EqualTo(3)); | ||
174 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
175 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
176 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
177 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | ||
178 | Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); | ||
179 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
180 | } | ||
130 | } | 181 | } |
131 | } \ No newline at end of file | 182 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 41d6628..d939329 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -909,7 +909,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
909 | { | 909 | { |
910 | } | 910 | } |
911 | 911 | ||
912 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 912 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
913 | { | 913 | { |
914 | } | 914 | } |
915 | 915 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs index 65158e1..d63da2e 100644 --- a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs | |||
@@ -38,18 +38,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
38 | 38 | ||
39 | IPrimCounts GetPrimCounts(UUID parcelID); | 39 | IPrimCounts GetPrimCounts(UUID parcelID); |
40 | } | 40 | } |
41 | 41 | } \ No newline at end of file | |
42 | public interface IPrimCounts | ||
43 | { | ||
44 | int Owner { get; } | ||
45 | int Group { get; } | ||
46 | int Others { get; } | ||
47 | int Simulator { get; } | ||
48 | IUserPrimCounts Users { get; } | ||
49 | } | ||
50 | |||
51 | public interface IUserPrimCounts | ||
52 | { | ||
53 | int this[UUID agentID] { get; } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 49382f0..821cd4b 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 | |||
1247 | 1247 | ||
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 1250 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
1251 | { | 1251 | { |
1252 | 1252 | ||
1253 | } | 1253 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs index 8df020f..c898da6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenSim.Framework; | ||
28 | using OpenSim.Region.Framework.Interfaces; | 29 | using OpenSim.Region.Framework.Interfaces; |
29 | using OpenSim.Region.Framework.Scenes; | 30 | using OpenSim.Region.Framework.Scenes; |
30 | 31 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5d44aa1..96760a2 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 | |||
925 | { | 925 | { |
926 | } | 926 | } |
927 | 927 | ||
928 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 928 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
929 | { | 929 | { |
930 | } | 930 | } |
931 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 931 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) |