aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs60
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandObject.cs5
5 files changed, 52 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 4d887a8..d0727d9 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -72,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land
72 protected Commander m_commander = new Commander("land"); 72 protected Commander m_commander = new Commander("land");
73 73
74 protected IUserManagement m_userManager; 74 protected IUserManagement m_userManager;
75 protected IPrimCountModule m_primCountModule;
75 76
76 // Minimum for parcels to work is 64m even if we don't actually use them. 77 // Minimum for parcels to work is 64m even if we don't actually use them.
77 #pragma warning disable 0429 78 #pragma warning disable 0429
@@ -147,6 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land
147 public void RegionLoaded(Scene scene) 148 public void RegionLoaded(Scene scene)
148 { 149 {
149 m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); 150 m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
151 m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
150 } 152 }
151 153
152 public void RemoveRegion(Scene scene) 154 public void RemoveRegion(Scene scene)
@@ -309,10 +311,11 @@ namespace OpenSim.Region.CoreModules.World.Land
309// m_log.DebugFormat( 311// m_log.DebugFormat(
310// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); 312// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
311 313
312 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 314 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
313 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 315 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
314 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 316 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
315 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); 317 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
318
316 return AddLandObject(fullSimParcel); 319 return AddLandObject(fullSimParcel);
317 } 320 }
318 321
@@ -593,6 +596,11 @@ namespace OpenSim.Region.CoreModules.World.Land
593 public ILandObject AddLandObject(ILandObject land) 596 public ILandObject AddLandObject(ILandObject land)
594 { 597 {
595 ILandObject new_land = land.Copy(); 598 ILandObject new_land = land.Copy();
599
600 // Only now can we add the prim counts to the land object - we rely on the global ID which is generated
601 // as a random UUID inside LandData initialization
602 if (m_primCountModule != null)
603 new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
596 604
597 lock (m_landList) 605 lock (m_landList)
598 { 606 {
@@ -1368,7 +1376,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1368 { 1376 {
1369 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1377 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1370 new_land.LandData = data.Copy(); 1378 new_land.LandData = data.Copy();
1371 new_land.SetLandBitmapFromByteArray(); 1379 new_land.SetLandBitmapFromByteArray();
1372 AddLandObject(new_land); 1380 AddLandObject(new_land);
1373 } 1381 }
1374 1382
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 46c15ed..749bb3d 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land
51 51
52 private int m_lastSeqId = 0; 52 private int m_lastSeqId = 0;
53 53
54 protected LandData m_landData = new LandData(); 54 protected LandData m_landData = new LandData();
55 protected Scene m_scene; 55 protected Scene m_scene;
56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); 57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
@@ -79,6 +79,8 @@ namespace OpenSim.Region.CoreModules.World.Land
79 79
80 set { m_landData = value; } 80 set { m_landData = value; }
81 } 81 }
82
83 public IPrimCounts PrimCounts { get; set; }
82 84
83 public UUID RegionUUID 85 public UUID RegionUUID
84 { 86 {
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index ae85798..9fd347e 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -88,6 +88,8 @@ namespace OpenSim.Region.CoreModules.World.Land
88 public void AddRegion(Scene scene) 88 public void AddRegion(Scene scene)
89 { 89 {
90 m_Scene = scene; 90 m_Scene = scene;
91
92 m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
91 93
92 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; 94 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
93 m_Scene.EventManager.OnObjectBeingRemovedFromScene += 95 m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 45e579e..c9d393f 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -58,9 +58,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
58 m_scene = SceneSetupHelpers.SetupScene(); 58 m_scene = SceneSetupHelpers.SetupScene();
59 SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); 59 SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
60 60
61 m_lo = new LandObject(m_userId, false, m_scene); 61 ILandObject lo = new LandObject(m_userId, false, m_scene);
62 m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 62 lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
63 lmm.AddLandObject(m_lo); 63 m_lo = lmm.AddLandObject(lo);
64 //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); 64 //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
65 } 65 }
66 66
@@ -72,34 +72,36 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
72 { 72 {
73 TestHelper.InMethod(); 73 TestHelper.InMethod();
74// log4net.Config.XmlConfigurator.Configure(); 74// log4net.Config.XmlConfigurator.Configure();
75 75
76 Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 76 IPrimCounts pc = m_lo.PrimCounts;
77 Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 77
78 Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 78 Assert.That(pc.Owner, Is.EqualTo(0));
79 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0)); 79 Assert.That(pc.Group, Is.EqualTo(0));
80 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); 80 Assert.That(pc.Others, Is.EqualTo(0));
81 Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 81 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
82 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
83 Assert.That(pc.Simulator, Is.EqualTo(0));
82 84
83 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 85 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
84 m_scene.AddNewSceneObject(sog, false); 86 m_scene.AddNewSceneObject(sog, false);
85 87
86 Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); 88 Assert.That(pc.Owner, Is.EqualTo(3));
87 Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 89 Assert.That(pc.Group, Is.EqualTo(0));
88 Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 90 Assert.That(pc.Others, Is.EqualTo(0));
89 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3)); 91 Assert.That(pc.Users[m_userId], Is.EqualTo(3));
90 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); 92 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
91 Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); 93 Assert.That(pc.Simulator, Is.EqualTo(3));
92 94
93 // Add a second object and retest 95 // Add a second object and retest
94 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); 96 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10);
95 m_scene.AddNewSceneObject(sog2, false); 97 m_scene.AddNewSceneObject(sog2, false);
96 98
97 Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); 99 Assert.That(pc.Owner, Is.EqualTo(5));
98 Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 100 Assert.That(pc.Group, Is.EqualTo(0));
99 Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 101 Assert.That(pc.Others, Is.EqualTo(0));
100 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5)); 102 Assert.That(pc.Users[m_userId], Is.EqualTo(5));
101 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); 103 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
102 Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); 104 Assert.That(pc.Simulator, Is.EqualTo(5));
103 } 105 }
104 106
105 /// <summary> 107 /// <summary>
@@ -111,17 +113,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
111 TestHelper.InMethod(); 113 TestHelper.InMethod();
112// log4net.Config.XmlConfigurator.Configure(); 114// log4net.Config.XmlConfigurator.Configure();
113 115
116 IPrimCounts pc = m_lo.PrimCounts;
117
114 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); 118 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false);
115 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); 119 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10);
116 m_scene.AddNewSceneObject(sogToDelete, false); 120 m_scene.AddNewSceneObject(sogToDelete, false);
117 m_scene.DeleteSceneObject(sogToDelete, false); 121 m_scene.DeleteSceneObject(sogToDelete, false);
118 122
119 Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); 123 Assert.That(pc.Owner, Is.EqualTo(1));
120 Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 124 Assert.That(pc.Group, Is.EqualTo(0));
121 Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); 125 Assert.That(pc.Others, Is.EqualTo(0));
122 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1)); 126 Assert.That(pc.Users[m_userId], Is.EqualTo(1));
123 Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); 127 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
124 Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); 128 Assert.That(pc.Simulator, Is.EqualTo(1));
125 } 129 }
126 } 130 }
127} \ No newline at end of file 131} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index eeb9d3a..9c0abde 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -46,6 +46,11 @@ namespace OpenSim.Region.Framework.Interfaces
46 UUID RegionUUID { get; } 46 UUID RegionUUID { get; }
47 47
48 /// <summary> 48 /// <summary>
49 /// Prim counts for this land object.
50 /// </summary>
51 IPrimCounts PrimCounts { get; set; }
52
53 /// <summary>
49 /// The start point for the land object. This is the western-most point as one scans land working from 54 /// The start point for the land object. This is the western-most point as one scans land working from
50 /// north to south. 55 /// north to south.
51 /// </summary> 56 /// </summary>