aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/LandManagement/LandManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/LandManagement/LandManager.cs')
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs168
1 files changed, 93 insertions, 75 deletions
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