diff options
author | Justin Clark-Casey (justincc) | 2011-04-06 18:57:50 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-04-06 18:57:50 +0100 |
commit | 63533412f882fd55c0c40989d97f8a8262bc4e3c (patch) | |
tree | 4091a21cf52762e5227f1771d2017f762c451dab /OpenSim/Region/CoreModules/World/Land | |
parent | Add method doc to some land bitmap methods in ILandObject. (diff) | |
download | opensim-SC-63533412f882fd55c0c40989d97f8a8262bc4e3c.zip opensim-SC-63533412f882fd55c0c40989d97f8a8262bc4e3c.tar.gz opensim-SC-63533412f882fd55c0c40989d97f8a8262bc4e3c.tar.bz2 opensim-SC-63533412f882fd55c0c40989d97f8a8262bc4e3c.tar.xz |
Improve previous ILandObject method doc.
For test code, take a part name prefix when creating objects, so that these can be more easily identified in the logs
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
3 files changed, 87 insertions, 49 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index abc7a3a..bfab7b8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -612,6 +612,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
612 | { | 612 | { |
613 | if (landBitmap[x, y]) | 613 | if (landBitmap[x, y]) |
614 | { | 614 | { |
615 | // m_log.DebugFormat( | ||
616 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | ||
617 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); | ||
618 | |||
615 | m_landIDList[x, y] = newLandLocalID; | 619 | m_landIDList[x, y] = newLandLocalID; |
616 | } | 620 | } |
617 | } | 621 | } |
@@ -741,8 +745,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
741 | // Corner case. If an autoreturn happens during sim startup | 745 | // Corner case. If an autoreturn happens during sim startup |
742 | // we will come here with the list uninitialized | 746 | // we will come here with the list uninitialized |
743 | // | 747 | // |
748 | int landId = m_landIDList[x, y]; | ||
749 | |||
750 | // if (landId == 0) | ||
751 | // m_log.DebugFormat( | ||
752 | // "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", | ||
753 | // x, y, m_scene.RegionInfo.RegionName); | ||
754 | |||
744 | if (m_landList.ContainsKey(m_landIDList[x, y])) | 755 | if (m_landList.ContainsKey(m_landIDList[x, y])) |
745 | return m_landList[m_landIDList[x, y]]; | 756 | return m_landList[m_landIDList[x, y]]; |
757 | |||
746 | return null; | 758 | return null; |
747 | } | 759 | } |
748 | } | 760 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 7a04eb1..dca842a 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -173,24 +173,32 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
173 | 173 | ||
174 | // NOTE: Call under Taint Lock | 174 | // NOTE: Call under Taint Lock |
175 | private void AddObject(SceneObjectGroup obj) | 175 | private void AddObject(SceneObjectGroup obj) |
176 | { | 176 | { |
177 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); | ||
178 | |||
179 | if (obj.IsAttachment) | 177 | if (obj.IsAttachment) |
180 | return; | 178 | return; |
181 | if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) | 179 | if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) |
182 | return; | 180 | return; |
183 | 181 | ||
184 | Vector3 pos = obj.AbsolutePosition; | 182 | Vector3 pos = obj.AbsolutePosition; |
185 | ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); | 183 | ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); |
186 | 184 | ||
187 | // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it | 185 | // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it |
188 | if (landObject == null) | 186 | if (landObject == null) |
187 | { | ||
188 | // m_log.WarnFormat( | ||
189 | // "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}", | ||
190 | // obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName); | ||
191 | |||
189 | return; | 192 | return; |
193 | } | ||
190 | 194 | ||
191 | LandData landData = landObject.LandData; | 195 | LandData landData = landObject.LandData; |
192 | 196 | ||
193 | // m_log.DebugFormat( | 197 | // m_log.DebugFormat( |
198 | // "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}", | ||
199 | // obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName); | ||
200 | |||
201 | // m_log.DebugFormat( | ||
194 | // "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", | 202 | // "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", |
195 | // obj.Name, obj.OwnerID, landData.OwnerID); | 203 | // obj.Name, obj.OwnerID, landData.OwnerID); |
196 | 204 | ||
@@ -473,7 +481,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
473 | 481 | ||
474 | m_OwnerMap[landData.GlobalID] = landData.OwnerID; | 482 | m_OwnerMap[landData.GlobalID] = landData.OwnerID; |
475 | m_SimwideCounts[landData.OwnerID] = 0; | 483 | m_SimwideCounts[landData.OwnerID] = 0; |
476 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Adding parcel count for {0}", landData.GlobalID); | 484 | // m_log.DebugFormat( |
485 | // "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}", | ||
486 | // landData.Name, m_Scene.RegionInfo.RegionName); | ||
477 | m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); | 487 | m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); |
478 | } | 488 | } |
479 | 489 | ||
@@ -583,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
583 | } | 593 | } |
584 | } | 594 | } |
585 | } | 595 | } |
586 | } | 596 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 4acba18..d161bb8 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -51,9 +51,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
51 | protected PrimCountModule m_pcm; | 51 | protected PrimCountModule m_pcm; |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// A parcel that covers the entire sim. | 54 | /// A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side. |
55 | /// </summary> | 55 | /// </summary> |
56 | protected ILandObject m_lo; | 56 | protected ILandObject m_lo; |
57 | |||
58 | /// <summary> | ||
59 | /// A parcel that covers just the eastern strip of the sim. | ||
60 | /// </summary> | ||
61 | protected ILandObject m_lo2; | ||
57 | 62 | ||
58 | [SetUp] | 63 | [SetUp] |
59 | public void SetUp() | 64 | public void SetUp() |
@@ -63,10 +68,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
63 | m_scene = SceneSetupHelpers.SetupScene(); | 68 | m_scene = SceneSetupHelpers.SetupScene(); |
64 | SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); | 69 | SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); |
65 | 70 | ||
71 | int xParcelDivider = (int)Constants.RegionSize - 1; | ||
72 | |||
66 | ILandObject lo = new LandObject(m_userId, false, m_scene); | 73 | ILandObject lo = new LandObject(m_userId, false, m_scene); |
74 | lo.LandData.Name = "m_lo"; | ||
67 | lo.SetLandBitmap( | 75 | lo.SetLandBitmap( |
68 | lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize / 4 - 1, (int)Constants.RegionSize / 4 - 1)); | 76 | lo.GetSquareLandBitmap(0, 0, xParcelDivider, (int)Constants.RegionSize)); |
69 | m_lo = lmm.AddLandObject(lo); | 77 | m_lo = lmm.AddLandObject(lo); |
78 | |||
79 | ILandObject lo2 = new LandObject(m_userId, false, m_scene); | ||
80 | lo2.SetLandBitmap( | ||
81 | lo2.GetSquareLandBitmap(xParcelDivider, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
82 | lo2.LandData.Name = "m_lo2"; | ||
83 | m_lo2 = lmm.AddLandObject(lo2); | ||
70 | } | 84 | } |
71 | 85 | ||
72 | /// <summary> | 86 | /// <summary> |
@@ -98,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
98 | 112 | ||
99 | IPrimCounts pc = m_lo.PrimCounts; | 113 | IPrimCounts pc = m_lo.PrimCounts; |
100 | 114 | ||
101 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); | 115 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); |
102 | m_scene.AddNewSceneObject(sog, false); | 116 | m_scene.AddNewSceneObject(sog, false); |
103 | 117 | ||
104 | Assert.That(pc.Owner, Is.EqualTo(3)); | 118 | Assert.That(pc.Owner, Is.EqualTo(3)); |
@@ -111,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
111 | Assert.That(pc.Simulator, Is.EqualTo(3)); | 125 | Assert.That(pc.Simulator, Is.EqualTo(3)); |
112 | 126 | ||
113 | // Add a second object and retest | 127 | // Add a second object and retest |
114 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); | 128 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); |
115 | m_scene.AddNewSceneObject(sog2, false); | 129 | m_scene.AddNewSceneObject(sog2, false); |
116 | 130 | ||
117 | Assert.That(pc.Owner, Is.EqualTo(5)); | 131 | Assert.That(pc.Owner, Is.EqualTo(5)); |
@@ -135,7 +149,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
135 | 149 | ||
136 | IPrimCounts pc = m_lo.PrimCounts; | 150 | IPrimCounts pc = m_lo.PrimCounts; |
137 | 151 | ||
138 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); | 152 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); |
139 | m_scene.AddNewSceneObject(sog, false); | 153 | m_scene.AddNewSceneObject(sog, false); |
140 | m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); | 154 | m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); |
141 | 155 | ||
@@ -156,35 +170,37 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
156 | //[Test] | 170 | //[Test] |
157 | public void TestMoveOwnerObject() | 171 | public void TestMoveOwnerObject() |
158 | { | 172 | { |
159 | // TestHelper.InMethod(); | 173 | TestHelper.InMethod(); |
160 | //// log4net.Config.XmlConfigurator.Configure(); | 174 | log4net.Config.XmlConfigurator.Configure(); |
161 | // | 175 | |
162 | // IPrimCounts pc = m_lo.PrimCounts; | 176 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); |
163 | // | 177 | m_scene.AddNewSceneObject(sog, false); |
164 | // SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); | 178 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); |
165 | // m_scene.AddNewSceneObject(sog, false); | 179 | m_scene.AddNewSceneObject(sog2, false); |
166 | // | 180 | |
167 | // Assert.That(pc.Owner, Is.EqualTo(3)); | 181 | sog.AbsolutePosition = new Vector3(254, 2, 2); |
168 | // Assert.That(pc.Group, Is.EqualTo(0)); | 182 | |
169 | // Assert.That(pc.Others, Is.EqualTo(0)); | 183 | IPrimCounts pclo1 = m_lo.PrimCounts; |
170 | // Assert.That(pc.Total, Is.EqualTo(3)); | 184 | |
171 | // Assert.That(pc.Selected, Is.EqualTo(0)); | 185 | Assert.That(pclo1.Owner, Is.EqualTo(2)); |
172 | // Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | 186 | Assert.That(pclo1.Group, Is.EqualTo(0)); |
173 | // Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | 187 | Assert.That(pclo1.Others, Is.EqualTo(0)); |
174 | // Assert.That(pc.Simulator, Is.EqualTo(3)); | 188 | Assert.That(pclo1.Total, Is.EqualTo(2)); |
175 | // | 189 | Assert.That(pclo1.Selected, Is.EqualTo(0)); |
176 | // // Add a second object and retest | 190 | Assert.That(pclo1.Users[m_userId], Is.EqualTo(2)); |
177 | // SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); | 191 | Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); |
178 | // m_scene.AddNewSceneObject(sog2, false); | 192 | Assert.That(pclo1.Simulator, Is.EqualTo(2)); |
179 | // | 193 | |
180 | // Assert.That(pc.Owner, Is.EqualTo(5)); | 194 | IPrimCounts pclo2 = m_lo2.PrimCounts; |
181 | // Assert.That(pc.Group, Is.EqualTo(0)); | 195 | |
182 | // Assert.That(pc.Others, Is.EqualTo(0)); | 196 | Assert.That(pclo2.Owner, Is.EqualTo(3)); |
183 | // Assert.That(pc.Total, Is.EqualTo(5)); | 197 | Assert.That(pclo2.Group, Is.EqualTo(0)); |
184 | // Assert.That(pc.Selected, Is.EqualTo(0)); | 198 | Assert.That(pclo2.Others, Is.EqualTo(0)); |
185 | // Assert.That(pc.Users[m_userId], Is.EqualTo(5)); | 199 | Assert.That(pclo2.Total, Is.EqualTo(3)); |
186 | // Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | 200 | Assert.That(pclo2.Selected, Is.EqualTo(0)); |
187 | // Assert.That(pc.Simulator, Is.EqualTo(5)); | 201 | Assert.That(pclo2.Users[m_userId], Is.EqualTo(3)); |
202 | Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); | ||
203 | Assert.That(pclo2.Simulator, Is.EqualTo(3)); | ||
188 | } | 204 | } |
189 | 205 | ||
190 | /// <summary> | 206 | /// <summary> |
@@ -198,8 +214,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
198 | 214 | ||
199 | IPrimCounts pc = m_lo.PrimCounts; | 215 | IPrimCounts pc = m_lo.PrimCounts; |
200 | 216 | ||
201 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); | 217 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); |
202 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); | 218 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); |
203 | m_scene.AddNewSceneObject(sogToDelete, false); | 219 | m_scene.AddNewSceneObject(sogToDelete, false); |
204 | m_scene.DeleteSceneObject(sogToDelete, false); | 220 | m_scene.DeleteSceneObject(sogToDelete, false); |
205 | 221 | ||
@@ -223,7 +239,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
223 | 239 | ||
224 | IPrimCounts pc = m_lo.PrimCounts; | 240 | IPrimCounts pc = m_lo.PrimCounts; |
225 | 241 | ||
226 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); | 242 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); |
227 | sog.GroupID = m_groupId; | 243 | sog.GroupID = m_groupId; |
228 | m_scene.AddNewSceneObject(sog, false); | 244 | m_scene.AddNewSceneObject(sog, false); |
229 | 245 | ||
@@ -254,11 +270,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
254 | 270 | ||
255 | IPrimCounts pc = m_lo.PrimCounts; | 271 | IPrimCounts pc = m_lo.PrimCounts; |
256 | 272 | ||
257 | SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1); | 273 | SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1); |
258 | sogToKeep.GroupID = m_groupId; | 274 | sogToKeep.GroupID = m_groupId; |
259 | m_scene.AddNewSceneObject(sogToKeep, false); | 275 | m_scene.AddNewSceneObject(sogToKeep, false); |
260 | 276 | ||
261 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); | 277 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); |
262 | m_scene.AddNewSceneObject(sogToDelete, false); | 278 | m_scene.AddNewSceneObject(sogToDelete, false); |
263 | m_scene.DeleteSceneObject(sogToDelete, false); | 279 | m_scene.DeleteSceneObject(sogToDelete, false); |
264 | 280 | ||
@@ -281,7 +297,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
281 | 297 | ||
282 | IPrimCounts pc = m_lo.PrimCounts; | 298 | IPrimCounts pc = m_lo.PrimCounts; |
283 | 299 | ||
284 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); | 300 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); |
285 | m_scene.AddNewSceneObject(sog, false); | 301 | m_scene.AddNewSceneObject(sog, false); |
286 | 302 | ||
287 | Assert.That(pc.Owner, Is.EqualTo(0)); | 303 | Assert.That(pc.Owner, Is.EqualTo(0)); |
@@ -302,8 +318,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
302 | 318 | ||
303 | IPrimCounts pc = m_lo.PrimCounts; | 319 | IPrimCounts pc = m_lo.PrimCounts; |
304 | 320 | ||
305 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, 0x1), false); | 321 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); |
306 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x10); | 322 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); |
307 | m_scene.AddNewSceneObject(sogToDelete, false); | 323 | m_scene.AddNewSceneObject(sogToDelete, false); |
308 | m_scene.DeleteSceneObject(sogToDelete, false); | 324 | m_scene.DeleteSceneObject(sogToDelete, false); |
309 | 325 | ||
@@ -326,7 +342,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
326 | TestHelper.InMethod(); | 342 | TestHelper.InMethod(); |
327 | IPrimCounts pc = m_lo.PrimCounts; | 343 | IPrimCounts pc = m_lo.PrimCounts; |
328 | 344 | ||
329 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); | 345 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); |
330 | m_scene.AddNewSceneObject(sog, false); | 346 | m_scene.AddNewSceneObject(sog, false); |
331 | 347 | ||
332 | m_pcm.TaintPrimCount(); | 348 | m_pcm.TaintPrimCount(); |