aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land
diff options
context:
space:
mode:
authorMelanie2011-04-08 04:16:29 +0100
committerMelanie2011-04-08 04:16:29 +0100
commit738daadaceada157eb0a8ea4a3437e037859b4d2 (patch)
tree1d0f8d63180928d77a7842e73c56e922666af75b /OpenSim/Region/CoreModules/World/Land
parentAdd support for the new display name related functions in LSL. This does not (diff)
parenttrivial whitespace removal to trigger a panda rebuild (diff)
downloadopensim-SC-738daadaceada157eb0a8ea4a3437e037859b4d2.zip
opensim-SC-738daadaceada157eb0a8ea4a3437e037859b4d2.tar.gz
opensim-SC-738daadaceada157eb0a8ea4a3437e037859b4d2.tar.bz2
opensim-SC-738daadaceada157eb0a8ea4a3437e037859b4d2.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs114
4 files changed, 130 insertions, 35 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 9905a53..f28faed 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -529,6 +529,10 @@ namespace OpenSim.Region.CoreModules.World.Land
529 { 529 {
530 if (landBitmap[x, y]) 530 if (landBitmap[x, y])
531 { 531 {
532// m_log.DebugFormat(
533// "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
534// new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
535
532 m_landIDList[x, y] = newLandLocalID; 536 m_landIDList[x, y] = newLandLocalID;
533 } 537 }
534 } 538 }
@@ -658,8 +662,16 @@ namespace OpenSim.Region.CoreModules.World.Land
658 // Corner case. If an autoreturn happens during sim startup 662 // Corner case. If an autoreturn happens during sim startup
659 // we will come here with the list uninitialized 663 // we will come here with the list uninitialized
660 // 664 //
665 int landId = m_landIDList[x, y];
666
667// if (landId == 0)
668// m_log.DebugFormat(
669// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
670// x, y, m_scene.RegionInfo.RegionName);
671
661 if (m_landList.ContainsKey(m_landIDList[x, y])) 672 if (m_landList.ContainsKey(m_landIDList[x, y]))
662 return m_landList[m_landIDList[x, y]]; 673 return m_landList[m_landIDList[x, y]];
674
663 return null; 675 return null;
664 } 676 }
665 } 677 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 57c7fc6..fe6b83a 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -736,23 +736,11 @@ namespace OpenSim.Region.CoreModules.World.Land
736 return LandBitmap; 736 return LandBitmap;
737 } 737 }
738 738
739 /// <summary>
740 /// Full sim land object creation
741 /// </summary>
742 /// <returns></returns>
743 public bool[,] BasicFullRegionLandBitmap() 739 public bool[,] BasicFullRegionLandBitmap()
744 { 740 {
745 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); 741 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
746 } 742 }
747 743
748 /// <summary>
749 /// Used to modify the bitmap between the x and y points. Points use 64 scale
750 /// </summary>
751 /// <param name="start_x"></param>
752 /// <param name="start_y"></param>
753 /// <param name="end_x"></param>
754 /// <param name="end_y"></param>
755 /// <returns></returns>
756 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 744 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
757 { 745 {
758 bool[,] tempBitmap = new bool[64,64]; 746 bool[,] tempBitmap = new bool[64,64];
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 9e931a6..f466194 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -173,19 +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);
184
185 // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it
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
192 return;
193 }
194
186 LandData landData = landObject.LandData; 195 LandData landData = landObject.LandData;
187 196
188// 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(
189// "[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}",
190// obj.Name, obj.OwnerID, landData.OwnerID); 203// obj.Name, obj.OwnerID, landData.OwnerID);
191 204
@@ -468,7 +481,9 @@ namespace OpenSim.Region.CoreModules.World.Land
468 481
469 m_OwnerMap[landData.GlobalID] = landData.OwnerID; 482 m_OwnerMap[landData.GlobalID] = landData.OwnerID;
470 m_SimwideCounts[landData.OwnerID] = 0; 483 m_SimwideCounts[landData.OwnerID] = 0;
471// 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);
472 m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); 487 m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
473 } 488 }
474 489
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index f006db2..67b00ac 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -49,7 +49,16 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
49 protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); 49 protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999");
50 protected TestScene m_scene; 50 protected TestScene m_scene;
51 protected PrimCountModule m_pcm; 51 protected PrimCountModule m_pcm;
52
53 /// <summary>
54 /// A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side.
55 /// </summary>
52 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;
53 62
54 [SetUp] 63 [SetUp]
55 public void SetUp() 64 public void SetUp()
@@ -59,10 +68,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
59 m_scene = SceneSetupHelpers.SetupScene(); 68 m_scene = SceneSetupHelpers.SetupScene();
60 SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); 69 SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
61 70
71 int xParcelDivider = (int)Constants.RegionSize - 1;
72
62 ILandObject lo = new LandObject(m_userId, false, m_scene); 73 ILandObject lo = new LandObject(m_userId, false, m_scene);
63 lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 74 lo.LandData.Name = "m_lo";
64 m_lo = lmm.AddLandObject(lo); 75 lo.SetLandBitmap(
65 //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); 76 lo.GetSquareLandBitmap(0, 0, xParcelDivider, (int)Constants.RegionSize));
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);
66 } 84 }
67 85
68 /// <summary> 86 /// <summary>
@@ -94,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
94 112
95 IPrimCounts pc = m_lo.PrimCounts; 113 IPrimCounts pc = m_lo.PrimCounts;
96 114
97 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 115 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
98 m_scene.AddNewSceneObject(sog, false); 116 m_scene.AddNewSceneObject(sog, false);
99 117
100 Assert.That(pc.Owner, Is.EqualTo(3)); 118 Assert.That(pc.Owner, Is.EqualTo(3));
@@ -107,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
107 Assert.That(pc.Simulator, Is.EqualTo(3)); 125 Assert.That(pc.Simulator, Is.EqualTo(3));
108 126
109 // Add a second object and retest 127 // Add a second object and retest
110 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); 128 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
111 m_scene.AddNewSceneObject(sog2, false); 129 m_scene.AddNewSceneObject(sog2, false);
112 130
113 Assert.That(pc.Owner, Is.EqualTo(5)); 131 Assert.That(pc.Owner, Is.EqualTo(5));
@@ -124,14 +142,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
124 /// Test count after a parcel owner owned copied object is added. 142 /// Test count after a parcel owner owned copied object is added.
125 /// </summary> 143 /// </summary>
126 [Test] 144 [Test]
127 public void TestCopiedOwnerObject() 145 public void TestCopyOwnerObject()
128 { 146 {
129 TestHelper.InMethod(); 147 TestHelper.InMethod();
130// log4net.Config.XmlConfigurator.Configure(); 148// log4net.Config.XmlConfigurator.Configure();
131 149
132 IPrimCounts pc = m_lo.PrimCounts; 150 IPrimCounts pc = m_lo.PrimCounts;
133 151
134 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 152 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
135 m_scene.AddNewSceneObject(sog, false); 153 m_scene.AddNewSceneObject(sog, false);
136 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);
137 155
@@ -143,7 +161,69 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
143 Assert.That(pc.Users[m_userId], Is.EqualTo(6)); 161 Assert.That(pc.Users[m_userId], Is.EqualTo(6));
144 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); 162 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
145 Assert.That(pc.Simulator, Is.EqualTo(6)); 163 Assert.That(pc.Simulator, Is.EqualTo(6));
146 } 164 }
165
166 /// <summary>
167 /// Test that parcel counts update correctly when an object is moved between parcels, where that movement
168 /// is not done directly by the user/
169 /// </summary>
170 [Test]
171 public void TestMoveOwnerObject()
172 {
173 TestHelper.InMethod();
174// log4net.Config.XmlConfigurator.Configure();
175
176 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
177 m_scene.AddNewSceneObject(sog, false);
178 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
179 m_scene.AddNewSceneObject(sog2, false);
180
181 // Move the first scene object to the eastern strip parcel
182 sog.AbsolutePosition = new Vector3(254, 2, 2);
183
184 IPrimCounts pclo1 = m_lo.PrimCounts;
185
186 Assert.That(pclo1.Owner, Is.EqualTo(2));
187 Assert.That(pclo1.Group, Is.EqualTo(0));
188 Assert.That(pclo1.Others, Is.EqualTo(0));
189 Assert.That(pclo1.Total, Is.EqualTo(2));
190 Assert.That(pclo1.Selected, Is.EqualTo(0));
191 Assert.That(pclo1.Users[m_userId], Is.EqualTo(2));
192 Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
193 Assert.That(pclo1.Simulator, Is.EqualTo(5));
194
195 IPrimCounts pclo2 = m_lo2.PrimCounts;
196
197 Assert.That(pclo2.Owner, Is.EqualTo(3));
198 Assert.That(pclo2.Group, Is.EqualTo(0));
199 Assert.That(pclo2.Others, Is.EqualTo(0));
200 Assert.That(pclo2.Total, Is.EqualTo(3));
201 Assert.That(pclo2.Selected, Is.EqualTo(0));
202 Assert.That(pclo2.Users[m_userId], Is.EqualTo(3));
203 Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
204 Assert.That(pclo2.Simulator, Is.EqualTo(5));
205
206 // Now move it back again
207 sog.AbsolutePosition = new Vector3(2, 2, 2);
208
209 Assert.That(pclo1.Owner, Is.EqualTo(5));
210 Assert.That(pclo1.Group, Is.EqualTo(0));
211 Assert.That(pclo1.Others, Is.EqualTo(0));
212 Assert.That(pclo1.Total, Is.EqualTo(5));
213 Assert.That(pclo1.Selected, Is.EqualTo(0));
214 Assert.That(pclo1.Users[m_userId], Is.EqualTo(5));
215 Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
216 Assert.That(pclo1.Simulator, Is.EqualTo(5));
217
218 Assert.That(pclo2.Owner, Is.EqualTo(0));
219 Assert.That(pclo2.Group, Is.EqualTo(0));
220 Assert.That(pclo2.Others, Is.EqualTo(0));
221 Assert.That(pclo2.Total, Is.EqualTo(0));
222 Assert.That(pclo2.Selected, Is.EqualTo(0));
223 Assert.That(pclo2.Users[m_userId], Is.EqualTo(0));
224 Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
225 Assert.That(pclo2.Simulator, Is.EqualTo(5));
226 }
147 227
148 /// <summary> 228 /// <summary>
149 /// Test count after a parcel owner owned object is removed. 229 /// Test count after a parcel owner owned object is removed.
@@ -156,8 +236,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
156 236
157 IPrimCounts pc = m_lo.PrimCounts; 237 IPrimCounts pc = m_lo.PrimCounts;
158 238
159 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); 239 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false);
160 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); 240 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
161 m_scene.AddNewSceneObject(sogToDelete, false); 241 m_scene.AddNewSceneObject(sogToDelete, false);
162 m_scene.DeleteSceneObject(sogToDelete, false); 242 m_scene.DeleteSceneObject(sogToDelete, false);
163 243
@@ -181,7 +261,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
181 261
182 IPrimCounts pc = m_lo.PrimCounts; 262 IPrimCounts pc = m_lo.PrimCounts;
183 263
184 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); 264 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
185 sog.GroupID = m_groupId; 265 sog.GroupID = m_groupId;
186 m_scene.AddNewSceneObject(sog, false); 266 m_scene.AddNewSceneObject(sog, false);
187 267
@@ -212,11 +292,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
212 292
213 IPrimCounts pc = m_lo.PrimCounts; 293 IPrimCounts pc = m_lo.PrimCounts;
214 294
215 SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1); 295 SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1);
216 sogToKeep.GroupID = m_groupId; 296 sogToKeep.GroupID = m_groupId;
217 m_scene.AddNewSceneObject(sogToKeep, false); 297 m_scene.AddNewSceneObject(sogToKeep, false);
218 298
219 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); 299 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
220 m_scene.AddNewSceneObject(sogToDelete, false); 300 m_scene.AddNewSceneObject(sogToDelete, false);
221 m_scene.DeleteSceneObject(sogToDelete, false); 301 m_scene.DeleteSceneObject(sogToDelete, false);
222 302
@@ -239,7 +319,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
239 319
240 IPrimCounts pc = m_lo.PrimCounts; 320 IPrimCounts pc = m_lo.PrimCounts;
241 321
242 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); 322 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
243 m_scene.AddNewSceneObject(sog, false); 323 m_scene.AddNewSceneObject(sog, false);
244 324
245 Assert.That(pc.Owner, Is.EqualTo(0)); 325 Assert.That(pc.Owner, Is.EqualTo(0));
@@ -260,8 +340,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
260 340
261 IPrimCounts pc = m_lo.PrimCounts; 341 IPrimCounts pc = m_lo.PrimCounts;
262 342
263 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, 0x1), false); 343 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false);
264 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x10); 344 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10);
265 m_scene.AddNewSceneObject(sogToDelete, false); 345 m_scene.AddNewSceneObject(sogToDelete, false);
266 m_scene.DeleteSceneObject(sogToDelete, false); 346 m_scene.DeleteSceneObject(sogToDelete, false);
267 347
@@ -284,7 +364,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
284 TestHelper.InMethod(); 364 TestHelper.InMethod();
285 IPrimCounts pc = m_lo.PrimCounts; 365 IPrimCounts pc = m_lo.PrimCounts;
286 366
287 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 367 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
288 m_scene.AddNewSceneObject(sog, false); 368 m_scene.AddNewSceneObject(sog, false);
289 369
290 m_pcm.TaintPrimCount(); 370 m_pcm.TaintPrimCount();