aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-18 18:22:50 +0000
committerTeravus Ovares2008-02-18 18:22:50 +0000
commit5944d5e7f65a05596ca2b6005e59eea85e09e838 (patch)
tree7d91af2cc97dcc30fbe723dca514995e2a84d14a /OpenSim/Region
parent* Make RegionProfileData.RequestSimProfileData static (diff)
downloadopensim-SC-5944d5e7f65a05596ca2b6005e59eea85e09e838.zip
opensim-SC-5944d5e7f65a05596ca2b6005e59eea85e09e838.tar.gz
opensim-SC-5944d5e7f65a05596ca2b6005e59eea85e09e838.tar.bz2
opensim-SC-5944d5e7f65a05596ca2b6005e59eea85e09e838.tar.xz
* Fixed a land manager exception or two with Math.Max(255,Math.Min(0,val))
* Trapped a few more into little self contained boxes with padlocks on them.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs17
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs57
2 files changed, 65 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index fec8899..58e40c2 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -47,6 +47,8 @@ namespace OpenSim.Region.Environment.LandManagement
47 { 47 {
48 #region Member Variables 48 #region Member Variables
49 49
50 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
51
50 public LandData landData = new LandData(); 52 public LandData landData = new LandData();
51 public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 53 public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
52 public Scene m_scene; 54 public Scene m_scene;
@@ -282,11 +284,20 @@ namespace OpenSim.Region.Environment.LandManagement
282 public void sendLandUpdateToAvatarsOverMe() 284 public void sendLandUpdateToAvatarsOverMe()
283 { 285 {
284 List<ScenePresence> avatars = m_scene.GetAvatars(); 286 List<ScenePresence> avatars = m_scene.GetAvatars();
287 Land over = null;
285 for (int i = 0; i < avatars.Count; i++) 288 for (int i = 0; i < avatars.Count; i++)
286 { 289 {
287 Land over = 290 try
288 m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X), 291 {
289 (int) Math.Round(avatars[i].AbsolutePosition.Y)); 292 over =
293 m_scene.LandManager.getLandObject((int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.X))),
294 (int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.Y))));
295 }
296 catch (Exception)
297 {
298 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + Math.Round(avatars[i].AbsolutePosition.Y));
299 }
300
290 if (over != null) 301 if (over != null)
291 { 302 {
292 if (over.landData.localID == landData.localID) 303 if (over.landData.localID == landData.localID)
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 47201f3..017fce8 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -310,7 +310,15 @@ namespace OpenSim.Region.Environment.LandManagement
310 { 310 {
311 //First, lets loop through the points and make sure they are all in the same peice of land 311 //First, lets loop through the points and make sure they are all in the same peice of land
312 //Get the land object at start 312 //Get the land object at start
313 Land startLandObject = getLandObject(start_x, start_y); 313 Land startLandObject = null;
314 try
315 {
316 startLandObject = getLandObject(start_x, start_y);
317 }
318 catch (Exception)
319 {
320 m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + start_x + " y:" + start_y);
321 }
314 if (startLandObject == null) return false; //No such land object at the beginning 322 if (startLandObject == null) return false; //No such land object at the beginning
315 323
316 //Loop through the points 324 //Loop through the points
@@ -386,7 +394,15 @@ namespace OpenSim.Region.Environment.LandManagement
386 { 394 {
387 for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) 395 for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
388 { 396 {
389 Land p = getLandObject(stepXSelected, stepYSelected); 397 Land p = null;
398 try
399 {
400 p = getLandObject(stepXSelected, stepYSelected);
401 }
402 catch (Exception)
403 {
404 m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + stepXSelected + " y:" + stepYSelected);
405 }
390 if (p != null) 406 if (p != null)
391 { 407 {
392 if (!selectedLandObjects.Contains(p)) 408 if (!selectedLandObjects.Contains(p))
@@ -452,7 +468,18 @@ namespace OpenSim.Region.Environment.LandManagement
452 for (x = 0; x < 64; x++) 468 for (x = 0; x < 64; x++)
453 { 469 {
454 byte tempByte = (byte) 0; //This represents the byte for the current 4x4 470 byte tempByte = (byte) 0; //This represents the byte for the current 4x4
455 Land currentParcelBlock = getLandObject(x*4, y*4); 471 Land currentParcelBlock = null;
472
473 try
474 {
475 currentParcelBlock = getLandObject(x * 4, y * 4);
476 }
477 catch (Exception)
478 {
479 m_log.Warn("[LAND]: " + "unable to get land at x: " + (x * 4) + " y: " + (y * 4));
480 }
481
482
456 if (currentParcelBlock != null) 483 if (currentParcelBlock != null)
457 { 484 {
458 if (currentParcelBlock.landData.ownerID == remote_client.AgentId) 485 if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
@@ -545,7 +572,16 @@ namespace OpenSim.Region.Environment.LandManagement
545 { 572 {
546 for (y = 0; y < inc_y; y++) 573 for (y = 0; y < inc_y; y++)
547 { 574 {
548 Land currentParcel = getLandObject(start_x + x, start_y + y); 575
576 Land currentParcel = null;
577 try
578 {
579 getLandObject(start_x + x, start_y + y);
580 }
581 catch (Exception)
582 {
583 m_log.Warn("[LAND]: " + "unable to get land at x: " + (start_x + x) + " y: " + (start_y + y));
584 }
549 if (currentParcel != null) 585 if (currentParcel != null)
550 { 586 {
551 if (!temp.Contains(currentParcel)) 587 if (!temp.Contains(currentParcel))
@@ -699,6 +735,7 @@ namespace OpenSim.Region.Environment.LandManagement
699 { 735 {
700 if (presence.UUID == avatar.AgentId) 736 if (presence.UUID == avatar.AgentId)
701 { 737 {
738
702 List<Land> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition); 739 List<Land> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition);
703 foreach (Land checkBan in checkLandParcels) 740 foreach (Land checkBan in checkLandParcels)
704 { 741 {
@@ -720,8 +757,16 @@ namespace OpenSim.Region.Environment.LandManagement
720 757
721 public void sendLandUpdate(ScenePresence avatar, bool force) 758 public void sendLandUpdate(ScenePresence avatar, bool force)
722 { 759 {
723 Land over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), 760 Land over = null;
724 (int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); 761 try
762 {
763 over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
764 (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
765 }
766 catch (Exception)
767 {
768 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + Math.Round(avatar.AbsolutePosition.Y));
769 }
725 770
726 if (over != null) 771 if (over != null)
727 { 772 {