diff options
author | mingchen | 2007-12-21 00:35:55 +0000 |
---|---|---|
committer | mingchen | 2007-12-21 00:35:55 +0000 |
commit | 37ea05088610db79ad3c6c99d1dfa818e98ccc26 (patch) | |
tree | a391b5e80818436917d488b637ccbdec21913b9f /OpenSim | |
parent | *on more implicit use of .ToString() on deleting shapes in MonoSqliteDataStore (diff) | |
download | opensim-SC-37ea05088610db79ad3c6c99d1dfa818e98ccc26.zip opensim-SC-37ea05088610db79ad3c6c99d1dfa818e98ccc26.tar.gz opensim-SC-37ea05088610db79ad3c6c99d1dfa818e98ccc26.tar.bz2 opensim-SC-37ea05088610db79ad3c6c99d1dfa818e98ccc26.tar.xz |
*Removed some exceptions that were thrown in Land that is no longer needed.
Diffstat (limited to 'OpenSim')
4 files changed, 126 insertions, 84 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index da17a69..11ff0ee 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs | |||
@@ -227,6 +227,19 @@ namespace OpenSim.Region.Environment.LandManagement | |||
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
230 | public bool isEitherBannedOrRestricted(LLUUID avatar) | ||
231 | { | ||
232 | if (isBannedFromLand(avatar)) | ||
233 | { | ||
234 | return true; | ||
235 | } | ||
236 | else if (isRestrictedFromLand(avatar)) | ||
237 | { | ||
238 | return true; | ||
239 | } | ||
240 | return false; | ||
241 | } | ||
242 | |||
230 | public bool isBannedFromLand(LLUUID avatar) | 243 | public bool isBannedFromLand(LLUUID avatar) |
231 | { | 244 | { |
232 | if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0) | 245 | if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0) |
@@ -274,9 +287,12 @@ namespace OpenSim.Region.Environment.LandManagement | |||
274 | Land over = | 287 | Land over = |
275 | m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X), | 288 | m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X), |
276 | (int) Math.Round(avatars[i].AbsolutePosition.Y)); | 289 | (int) Math.Round(avatars[i].AbsolutePosition.Y)); |
277 | if (over.landData.localID == landData.localID) | 290 | if (over != null) |
278 | { | 291 | { |
279 | sendLandUpdateToClient(avatars[i].ControllingClient); | 292 | if (over.landData.localID == landData.localID) |
293 | { | ||
294 | sendLandUpdateToClient(avatars[i].ControllingClient); | ||
295 | } | ||
280 | } | 296 | } |
281 | } | 297 | } |
282 | } | 298 | } |
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index f984d58..c360f7f 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs | |||
@@ -192,7 +192,8 @@ namespace OpenSim.Region.Environment.LandManagement | |||
192 | { | 192 | { |
193 | if (landIDList[x, y] == local_id) | 193 | if (landIDList[x, y] == local_id) |
194 | { | 194 | { |
195 | throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); | 195 | return; |
196 | //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); | ||
196 | } | 197 | } |
197 | } | 198 | } |
198 | } | 199 | } |
@@ -210,7 +211,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
210 | } | 211 | } |
211 | else | 212 | else |
212 | { | 213 | { |
213 | throw new Exception("Could not update land object. Local ID '" + local_id + "' does not exist"); | 214 | //throw new Exception("Could not update land object. Local ID '" + local_id + "' does not exist"); |
214 | } | 215 | } |
215 | } | 216 | } |
216 | 217 | ||
@@ -246,10 +247,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
246 | 247 | ||
247 | if (x >= 64 || y >= 64 || x < 0 || y < 0) | 248 | if (x >= 64 || y >= 64 || x < 0 || y < 0) |
248 | { | 249 | { |
249 | // These exceptions here will cause a lot of complaints from the users specifically because | 250 | return null; |
250 | // they happen every time at border crossings | ||
251 | |||
252 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | ||
253 | } | 251 | } |
254 | else | 252 | else |
255 | { | 253 | { |
@@ -366,9 +364,12 @@ namespace OpenSim.Region.Environment.LandManagement | |||
366 | for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) | 364 | for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) |
367 | { | 365 | { |
368 | Land p = getLandObject(stepXSelected, stepYSelected); | 366 | Land p = getLandObject(stepXSelected, stepYSelected); |
369 | if (!selectedLandObjects.Contains(p)) | 367 | if (p != null) |
370 | { | 368 | { |
371 | selectedLandObjects.Add(p); | 369 | if (!selectedLandObjects.Contains(p)) |
370 | { | ||
371 | selectedLandObjects.Add(p); | ||
372 | } | ||
372 | } | 373 | } |
373 | } | 374 | } |
374 | } | 375 | } |
@@ -429,61 +430,66 @@ namespace OpenSim.Region.Environment.LandManagement | |||
429 | { | 430 | { |
430 | byte tempByte = (byte) 0; //This represents the byte for the current 4x4 | 431 | byte tempByte = (byte) 0; //This represents the byte for the current 4x4 |
431 | Land currentParcelBlock = getLandObject(x*4, y*4); | 432 | Land currentParcelBlock = getLandObject(x*4, y*4); |
432 | 433 | if (currentParcelBlock != null) | |
433 | if (currentParcelBlock.landData.ownerID == remote_client.AgentId) | ||
434 | { | 434 | { |
435 | //Owner Flag | 435 | if (currentParcelBlock.landData.ownerID == remote_client.AgentId) |
436 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); | 436 | { |
437 | } | 437 | //Owner Flag |
438 | else if (currentParcelBlock.landData.salePrice > 0 && | 438 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); |
439 | (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || | 439 | } |
440 | currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) | 440 | else if (currentParcelBlock.landData.salePrice > 0 && |
441 | { | 441 | (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || |
442 | //Sale Flag | 442 | currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) |
443 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); | 443 | { |
444 | } | 444 | //Sale Flag |
445 | else if (currentParcelBlock.landData.ownerID == LLUUID.Zero) | 445 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); |
446 | { | 446 | } |
447 | //Public Flag | 447 | else if (currentParcelBlock.landData.ownerID == LLUUID.Zero) |
448 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_PUBLIC); | 448 | { |
449 | } | 449 | //Public Flag |
450 | else | 450 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_PUBLIC); |
451 | { | 451 | } |
452 | //Other Flag | 452 | else |
453 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_OTHER); | 453 | { |
454 | } | 454 | //Other Flag |
455 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_OTHER); | ||
456 | } | ||
455 | 457 | ||
456 | 458 | ||
457 | //Now for border control | 459 | //Now for border control |
458 | if (x == 0) | ||
459 | { | ||
460 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); | ||
461 | } | ||
462 | else if (getLandObject((x - 1)*4, y*4) != currentParcelBlock) | ||
463 | { | ||
464 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); | ||
465 | } | ||
466 | 460 | ||
467 | if (y == 0) | 461 | Land westParcel = getLandObject((x - 1) * 4, y * 4); |
468 | { | 462 | Land southParcel = getLandObject(x * 4, (y - 1) * 4); |
469 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); | 463 | if (x == 0) |
470 | } | 464 | { |
471 | else if (getLandObject(x*4, (y - 1)*4) != currentParcelBlock) | 465 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); |
472 | { | 466 | } |
473 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); | 467 | else if (westParcel != null && westParcel != currentParcelBlock) |
474 | } | 468 | { |
469 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); | ||
470 | } | ||
475 | 471 | ||
476 | byteArray[byteArrayCount] = tempByte; | 472 | if (y == 0) |
477 | byteArrayCount++; | 473 | { |
478 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | 474 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); |
479 | { | 475 | } |
480 | byteArrayCount = 0; | 476 | else if (southParcel != null && southParcel != currentParcelBlock) |
481 | packet = new ParcelOverlayPacket(); | 477 | { |
482 | packet.ParcelData.Data = byteArray; | 478 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); |
483 | packet.ParcelData.SequenceID = sequenceID; | 479 | } |
484 | remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task); | 480 | |
485 | sequenceID++; | 481 | byteArray[byteArrayCount] = tempByte; |
486 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 482 | byteArrayCount++; |
483 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | ||
484 | { | ||
485 | byteArrayCount = 0; | ||
486 | packet = new ParcelOverlayPacket(); | ||
487 | packet.ParcelData.Data = byteArray; | ||
488 | packet.ParcelData.SequenceID = sequenceID; | ||
489 | remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task); | ||
490 | sequenceID++; | ||
491 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | ||
492 | } | ||
487 | } | 493 | } |
488 | } | 494 | } |
489 | } | 495 | } |
@@ -502,10 +508,13 @@ namespace OpenSim.Region.Environment.LandManagement | |||
502 | for (y = 0; y < inc_y; y++) | 508 | for (y = 0; y < inc_y; y++) |
503 | { | 509 | { |
504 | Land currentParcel = getLandObject(start_x + x, start_y + y); | 510 | Land currentParcel = getLandObject(start_x + x, start_y + y); |
505 | if (!temp.Contains(currentParcel)) | 511 | if (currentParcel != null) |
506 | { | 512 | { |
507 | currentParcel.forceUpdateLandInfo(); | 513 | if (!temp.Contains(currentParcel)) |
508 | temp.Add(currentParcel); | 514 | { |
515 | currentParcel.forceUpdateLandInfo(); | ||
516 | temp.Add(currentParcel); | ||
517 | } | ||
509 | } | 518 | } |
510 | } | 519 | } |
511 | } | 520 | } |
@@ -583,9 +592,12 @@ namespace OpenSim.Region.Environment.LandManagement | |||
583 | for (y = -4; y <= 4; y += 4) | 592 | for (y = -4; y <= 4; y += 4) |
584 | { | 593 | { |
585 | Land check = getLandObject(position.X + x, position.Y + y); | 594 | Land check = getLandObject(position.X + x, position.Y + y); |
586 | if (!parcelsNear.Contains(check)) | 595 | if (check != null) |
587 | { | 596 | { |
588 | parcelsNear.Add(check); | 597 | if (!parcelsNear.Contains(check)) |
598 | { | ||
599 | parcelsNear.Add(check); | ||
600 | } | ||
589 | } | 601 | } |
590 | } | 602 | } |
591 | } | 603 | } |
@@ -693,18 +705,21 @@ namespace OpenSim.Region.Environment.LandManagement | |||
693 | sendLandUpdate(clientAvatar); | 705 | sendLandUpdate(clientAvatar); |
694 | sendOutNearestBanLine(remote_client); | 706 | sendOutNearestBanLine(remote_client); |
695 | Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | 707 | Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); |
696 | if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | 708 | if (parcel != null) |
697 | { | 709 | { |
698 | 710 | if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | |
699 | handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); //They are going below the safety line! | ||
700 | if (!parcel.isBannedFromLand(clientAvatar.UUID)) | ||
701 | { | 711 | { |
702 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | 712 | |
713 | handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); //They are going below the safety line! | ||
714 | if (!parcel.isBannedFromLand(clientAvatar.UUID)) | ||
715 | { | ||
716 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | ||
717 | } | ||
718 | } | ||
719 | else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && parcel.isBannedFromLand(clientAvatar.UUID)) | ||
720 | { | ||
721 | sendYouAreBannedNotice(clientAvatar); | ||
703 | } | 722 | } |
704 | } | ||
705 | else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && parcel.isBannedFromLand(clientAvatar.UUID)) | ||
706 | { | ||
707 | sendYouAreBannedNotice(clientAvatar); | ||
708 | } | 723 | } |
709 | } | 724 | } |
710 | } | 725 | } |
@@ -712,11 +727,14 @@ namespace OpenSim.Region.Environment.LandManagement | |||
712 | public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. | 727 | public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. |
713 | { | 728 | { |
714 | Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 729 | Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
715 | if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) | 730 | if (over != null) |
716 | { | 731 | { |
717 | avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); | 732 | if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) |
718 | 733 | { | |
734 | avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); | ||
735 | |||
719 | 736 | ||
737 | } | ||
720 | } | 738 | } |
721 | } | 739 | } |
722 | 740 | ||
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 37df180..53fa08a 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -110,6 +110,8 @@ namespace OpenSim.Region.Environment | |||
110 | string reason = "Insufficient permission"; | 110 | string reason = "Insufficient permission"; |
111 | 111 | ||
112 | Land land = this.m_scene.LandManager.getLandObject(position.X, position.Y); | 112 | Land land = this.m_scene.LandManager.getLandObject(position.X, position.Y); |
113 | if (land == null) return false; | ||
114 | |||
113 | if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == (int)Parcel.ParcelFlags.CreateObjects) | 115 | if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == (int)Parcel.ParcelFlags.CreateObjects) |
114 | permission = true; | 116 | permission = true; |
115 | 117 | ||
@@ -176,8 +178,8 @@ namespace OpenSim.Region.Environment | |||
176 | return OwnerMask; | 178 | return OwnerMask; |
177 | 179 | ||
178 | // Users should be able to edit what is over their land. | 180 | // Users should be able to edit what is over their land. |
179 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == | 181 | Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); |
180 | user) | 182 | if (parcel != null && parcel.landData.ownerID == user) |
181 | return OwnerMask; | 183 | return OwnerMask; |
182 | 184 | ||
183 | // Estate users should be able to edit anything in the sim | 185 | // Estate users should be able to edit anything in the sim |
@@ -235,8 +237,8 @@ namespace OpenSim.Region.Environment | |||
235 | permission = true; | 237 | permission = true; |
236 | 238 | ||
237 | // Users should be able to edit what is over their land. | 239 | // Users should be able to edit what is over their land. |
238 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == | 240 | Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); |
239 | user) | 241 | if (parcel != null && parcel.landData.ownerID == user) |
240 | permission = true; | 242 | permission = true; |
241 | 243 | ||
242 | // Estate users should be able to edit anything in the sim | 244 | // Estate users should be able to edit anything in the sim |
@@ -399,7 +401,8 @@ namespace OpenSim.Region.Environment | |||
399 | Y = 0; | 401 | Y = 0; |
400 | 402 | ||
401 | // Land owner can terraform too | 403 | // Land owner can terraform too |
402 | if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(X, Y))) | 404 | Land parcel = m_scene.LandManager.getLandObject(X, Y); |
405 | if (parcel != null && GenericParcelPermission(user, parcel)) | ||
403 | permission = true; | 406 | permission = true; |
404 | 407 | ||
405 | if (!permission) | 408 | if (!permission) |
@@ -466,7 +469,9 @@ namespace OpenSim.Region.Environment | |||
466 | 469 | ||
467 | protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) | 470 | protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) |
468 | { | 471 | { |
469 | return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y)); | 472 | Land parcel = m_scene.LandManager.getLandObject(pos.X, pos.Y); |
473 | if (parcel == null) return false; | ||
474 | return GenericParcelPermission(user, parcel); | ||
470 | } | 475 | } |
471 | 476 | ||
472 | public virtual bool CanEditParcel(LLUUID user, Land parcel) | 477 | public virtual bool CanEditParcel(LLUUID user, Land parcel) |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs index 2895c4e..d6613e9 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs | |||
@@ -103,7 +103,10 @@ namespace OpenSim.Region.ExtensionsScriptModule | |||
103 | { | 103 | { |
104 | Vector myPosition = Task.AbsolutePosition; | 104 | Vector myPosition = Task.AbsolutePosition; |
105 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); | 105 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); |
106 | 106 | if (myParcel == null) | |
107 | { | ||
108 | //Dont do anything! | ||
109 | } | ||
107 | MainLog.Instance.Warn("script", | 110 | MainLog.Instance.Warn("script", |
108 | "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); | 111 | "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); |
109 | return; | 112 | return; |