aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-03-23 21:50:56 +0000
committerJustin Clark-Casey (justincc)2011-03-23 21:53:14 +0000
commitd011896341d09ce6c10a801264e663b6a19f0b48 (patch)
tree02369e0c5a2103e8f42f5bf6128814de9e2afaf5 /OpenSim/Region/CoreModules
parentFix a typo in the SQLite DLL config and amend the instructions for running on... (diff)
downloadopensim-SC-d011896341d09ce6c10a801264e663b6a19f0b48.zip
opensim-SC-d011896341d09ce6c10a801264e663b6a19f0b48.tar.gz
opensim-SC-d011896341d09ce6c10a801264e663b6a19f0b48.tar.bz2
opensim-SC-d011896341d09ce6c10a801264e663b6a19f0b48.tar.xz
Add generic EventManager.OnObjectAddedToScene and get PrimCountModule to listen for that rather than EventManager.OnParcelPrimCountAdd
OnParcelPrimCountAdd had the wrong semantics for the PrimCountModule - it was invoked for every entity in the scene, not just new ones, which would screw up the untainted count. Extend automated test for this scenario.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs2
3 files changed, 14 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 514be4f..4d887a8 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -854,6 +854,10 @@ namespace OpenSim.Region.CoreModules.World.Land
854 854
855 public void EventManagerOnParcelPrimCountUpdate() 855 public void EventManagerOnParcelPrimCountUpdate()
856 { 856 {
857// m_log.DebugFormat(
858// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}",
859// m_scene.RegionInfo.RegionName);
860
857 ResetAllLandPrimCounts(); 861 ResetAllLandPrimCounts();
858 EntityBase[] entities = m_scene.Entities.GetEntities(); 862 EntityBase[] entities = m_scene.Entities.GetEntities();
859 foreach (EntityBase obj in entities) 863 foreach (EntityBase obj in entities)
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index c71264c..5371aaf 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -89,8 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land
89 { 89 {
90 m_Scene = scene; 90 m_Scene = scene;
91 91
92 m_Scene.EventManager.OnParcelPrimCountAdd += 92 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
93 OnParcelPrimCountAdd;
94 m_Scene.EventManager.OnObjectBeingRemovedFromScene += 93 m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
95 OnObjectBeingRemovedFromScene; 94 OnObjectBeingRemovedFromScene;
96 m_Scene.EventManager.OnParcelPrimCountTainted += 95 m_Scene.EventManager.OnParcelPrimCountTainted +=
@@ -116,6 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Land
116 115
117 private void OnParcelPrimCountAdd(SceneObjectGroup obj) 116 private void OnParcelPrimCountAdd(SceneObjectGroup obj)
118 { 117 {
118 Console.WriteLine("WIBBLE");
119 // If we're tainted already, don't bother to add. The next 119 // If we're tainted already, don't bother to add. The next
120 // access will cause a recount anyway 120 // access will cause a recount anyway
121 lock (m_TaintLock) 121 lock (m_TaintLock)
@@ -172,6 +172,10 @@ namespace OpenSim.Region.CoreModules.World.Land
172 Vector3 pos = obj.AbsolutePosition; 172 Vector3 pos = obj.AbsolutePosition;
173 ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); 173 ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
174 LandData landData = landObject.LandData; 174 LandData landData = landObject.LandData;
175
176// m_log.DebugFormat(
177// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}",
178// obj.Name, obj.OwnerID, landData.OwnerID);
175 179
176 ParcelCounts parcelCounts; 180 ParcelCounts parcelCounts;
177 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) 181 if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
@@ -228,6 +232,8 @@ namespace OpenSim.Region.CoreModules.World.Land
228 232
229 public int GetOwnerCount(UUID parcelID) 233 public int GetOwnerCount(UUID parcelID)
230 { 234 {
235// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID);
236
231 lock (m_TaintLock) 237 lock (m_TaintLock)
232 { 238 {
233 if (m_Tainted) 239 if (m_Tainted)
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 402965f..fd332ed 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -67,6 +67,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
67 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 67 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
68 { Name = objName, UUID = objUuid }; 68 { Name = objName, UUID = objUuid };
69 69
70 Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
71
70 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 72 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
71 73
72 Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); 74 Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));