aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land/LandObject.cs
diff options
context:
space:
mode:
authorDan Lake2010-03-19 05:51:16 -0700
committerJohn Hurliman2010-03-19 15:16:35 -0700
commit859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 (patch)
treedcce6c74d201b52c1a04ec9ec2cb90ce068fc020 /OpenSim/Region/CoreModules/World/Land/LandObject.cs
parentInconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminati... (diff)
downloadopensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.zip
opensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.gz
opensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.bz2
opensim-SC_OLD-859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046.tar.xz
Cleaned up access to scenepresences in scenegraph. GetScenePresences and GetAvatars have been removed to consolidate locking and iteration within SceneGraph. All callers which used these to then iterate over presences have been refactored to instead pass their delegates to Scene.ForEachScenePresence(Action<ScenePresence>).
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/LandObject.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs26
1 files changed, 14 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index e85136a..b2d9b66 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -332,36 +332,38 @@ namespace OpenSim.Region.CoreModules.World.Land
332 332
333 public void SendLandUpdateToAvatarsOverMe(bool snap_selection) 333 public void SendLandUpdateToAvatarsOverMe(bool snap_selection)
334 { 334 {
335 List<ScenePresence> avatars = m_scene.GetAvatars(); 335 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
336 ILandObject over = null;
337 for (int i = 0; i < avatars.Count; i++)
338 { 336 {
337 if (avatar.IsChildAgent)
338 return;
339
340 ILandObject over = null;
339 try 341 try
340 { 342 {
341 over = 343 over =
342 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), 344 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)),
343 Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); 345 Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1)));
344 } 346 }
345 catch (Exception) 347 catch (Exception)
346 { 348 {
347 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + 349 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " +
348 Math.Round(avatars[i].AbsolutePosition.Y)); 350 Math.Round(avatar.AbsolutePosition.Y));
349 } 351 }
350 352
351 if (over != null) 353 if (over != null)
352 { 354 {
353 if (over.LandData.LocalID == LandData.LocalID) 355 if (over.LandData.LocalID == LandData.LocalID)
354 { 356 {
355 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && 357 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) &&
356 m_scene.RegionInfo.RegionSettings.AllowDamage) 358 m_scene.RegionInfo.RegionSettings.AllowDamage)
357 avatars[i].Invulnerable = false; 359 avatar.Invulnerable = false;
358 else 360 else
359 avatars[i].Invulnerable = true; 361 avatar.Invulnerable = true;
360 362
361 SendLandUpdateToClient(snap_selection, avatars[i].ControllingClient); 363 SendLandUpdateToClient(snap_selection, avatar.ControllingClient);
362 } 364 }
363 } 365 }
364 } 366 });
365 } 367 }
366 368
367 #endregion 369 #endregion