*Removed some exceptions that were thrown in Land that is no longer needed.

afrisby
mingchen 2007-12-21 00:35:55 +00:00
parent 9961a5565f
commit 37ea050886
4 changed files with 126 additions and 84 deletions

View File

@ -227,6 +227,19 @@ namespace OpenSim.Region.Environment.LandManagement
} }
} }
public bool isEitherBannedOrRestricted(LLUUID avatar)
{
if (isBannedFromLand(avatar))
{
return true;
}
else if (isRestrictedFromLand(avatar))
{
return true;
}
return false;
}
public bool isBannedFromLand(LLUUID avatar) public bool isBannedFromLand(LLUUID avatar)
{ {
if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0) if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0)
@ -274,9 +287,12 @@ namespace OpenSim.Region.Environment.LandManagement
Land over = Land over =
m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X), m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X),
(int) Math.Round(avatars[i].AbsolutePosition.Y)); (int) Math.Round(avatars[i].AbsolutePosition.Y));
if (over.landData.localID == landData.localID) if (over != null)
{ {
sendLandUpdateToClient(avatars[i].ControllingClient); if (over.landData.localID == landData.localID)
{
sendLandUpdateToClient(avatars[i].ControllingClient);
}
} }
} }
} }

View File

@ -192,7 +192,8 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
if (landIDList[x, y] == local_id) if (landIDList[x, y] == local_id)
{ {
throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); return;
//throw new Exception("Could not remove land object. Still being used at " + x + ", " + y);
} }
} }
} }
@ -210,7 +211,7 @@ namespace OpenSim.Region.Environment.LandManagement
} }
else else
{ {
throw new Exception("Could not update land object. Local ID '" + local_id + "' does not exist"); //throw new Exception("Could not update land object. Local ID '" + local_id + "' does not exist");
} }
} }
@ -246,10 +247,7 @@ namespace OpenSim.Region.Environment.LandManagement
if (x >= 64 || y >= 64 || x < 0 || y < 0) if (x >= 64 || y >= 64 || x < 0 || y < 0)
{ {
// These exceptions here will cause a lot of complaints from the users specifically because return null;
// they happen every time at border crossings
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
} }
else else
{ {
@ -366,9 +364,12 @@ namespace OpenSim.Region.Environment.LandManagement
for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
{ {
Land p = getLandObject(stepXSelected, stepYSelected); Land p = getLandObject(stepXSelected, stepYSelected);
if (!selectedLandObjects.Contains(p)) if (p != null)
{ {
selectedLandObjects.Add(p); if (!selectedLandObjects.Contains(p))
{
selectedLandObjects.Add(p);
}
} }
} }
} }
@ -429,61 +430,66 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
byte tempByte = (byte) 0; //This represents the byte for the current 4x4 byte tempByte = (byte) 0; //This represents the byte for the current 4x4
Land currentParcelBlock = getLandObject(x*4, y*4); Land currentParcelBlock = getLandObject(x*4, y*4);
if (currentParcelBlock != null)
if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
{ {
//Owner Flag if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); {
} //Owner Flag
else if (currentParcelBlock.landData.salePrice > 0 && tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER);
(currentParcelBlock.landData.authBuyerID == LLUUID.Zero || }
currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) else if (currentParcelBlock.landData.salePrice > 0 &&
{ (currentParcelBlock.landData.authBuyerID == LLUUID.Zero ||
//Sale Flag currentParcelBlock.landData.authBuyerID == remote_client.AgentId))
tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); {
} //Sale Flag
else if (currentParcelBlock.landData.ownerID == LLUUID.Zero) tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE);
{ }
//Public Flag else if (currentParcelBlock.landData.ownerID == LLUUID.Zero)
tempByte = Convert.ToByte(tempByte | LAND_TYPE_PUBLIC); {
} //Public Flag
else tempByte = Convert.ToByte(tempByte | LAND_TYPE_PUBLIC);
{ }
//Other Flag else
tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_OTHER); {
} //Other Flag
tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_OTHER);
}
//Now for border control //Now for border control
if (x == 0)
{
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
}
else if (getLandObject((x - 1)*4, y*4) != currentParcelBlock)
{
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
}
if (y == 0) Land westParcel = getLandObject((x - 1) * 4, y * 4);
{ Land southParcel = getLandObject(x * 4, (y - 1) * 4);
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); if (x == 0)
} {
else if (getLandObject(x*4, (y - 1)*4) != currentParcelBlock) tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
{ }
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); else if (westParcel != null && westParcel != currentParcelBlock)
} {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
}
byteArray[byteArrayCount] = tempByte; if (y == 0)
byteArrayCount++; {
if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
{ }
byteArrayCount = 0; else if (southParcel != null && southParcel != currentParcelBlock)
packet = new ParcelOverlayPacket(); {
packet.ParcelData.Data = byteArray; tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
packet.ParcelData.SequenceID = sequenceID; }
remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task);
sequenceID++; byteArray[byteArrayCount] = tempByte;
byteArray = new byte[LAND_BLOCKS_PER_PACKET]; byteArrayCount++;
if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
{
byteArrayCount = 0;
packet = new ParcelOverlayPacket();
packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task);
sequenceID++;
byteArray = new byte[LAND_BLOCKS_PER_PACKET];
}
} }
} }
} }
@ -502,10 +508,13 @@ namespace OpenSim.Region.Environment.LandManagement
for (y = 0; y < inc_y; y++) for (y = 0; y < inc_y; y++)
{ {
Land currentParcel = getLandObject(start_x + x, start_y + y); Land currentParcel = getLandObject(start_x + x, start_y + y);
if (!temp.Contains(currentParcel)) if (currentParcel != null)
{ {
currentParcel.forceUpdateLandInfo(); if (!temp.Contains(currentParcel))
temp.Add(currentParcel); {
currentParcel.forceUpdateLandInfo();
temp.Add(currentParcel);
}
} }
} }
} }
@ -583,9 +592,12 @@ namespace OpenSim.Region.Environment.LandManagement
for (y = -4; y <= 4; y += 4) for (y = -4; y <= 4; y += 4)
{ {
Land check = getLandObject(position.X + x, position.Y + y); Land check = getLandObject(position.X + x, position.Y + y);
if (!parcelsNear.Contains(check)) if (check != null)
{ {
parcelsNear.Add(check); if (!parcelsNear.Contains(check))
{
parcelsNear.Add(check);
}
} }
} }
} }
@ -693,18 +705,21 @@ namespace OpenSim.Region.Environment.LandManagement
sendLandUpdate(clientAvatar); sendLandUpdate(clientAvatar);
sendOutNearestBanLine(remote_client); sendOutNearestBanLine(remote_client);
Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) if (parcel != null)
{ {
if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); //They are going below the safety line!
if (!parcel.isBannedFromLand(clientAvatar.UUID))
{ {
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); //They are going below the safety line!
if (!parcel.isBannedFromLand(clientAvatar.UUID))
{
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
}
}
else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && parcel.isBannedFromLand(clientAvatar.UUID))
{
sendYouAreBannedNotice(clientAvatar);
} }
}
else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && parcel.isBannedFromLand(clientAvatar.UUID))
{
sendYouAreBannedNotice(clientAvatar);
} }
} }
} }
@ -712,11 +727,14 @@ namespace OpenSim.Region.Environment.LandManagement
public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance.
{ {
Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) if (over != null)
{ {
avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT)
{
avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
}
} }
} }

View File

@ -110,6 +110,8 @@ namespace OpenSim.Region.Environment
string reason = "Insufficient permission"; string reason = "Insufficient permission";
Land land = this.m_scene.LandManager.getLandObject(position.X, position.Y); Land land = this.m_scene.LandManager.getLandObject(position.X, position.Y);
if (land == null) return false;
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == (int)Parcel.ParcelFlags.CreateObjects) if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == (int)Parcel.ParcelFlags.CreateObjects)
permission = true; permission = true;
@ -176,8 +178,8 @@ namespace OpenSim.Region.Environment
return OwnerMask; return OwnerMask;
// Users should be able to edit what is over their land. // Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
user) if (parcel != null && parcel.landData.ownerID == user)
return OwnerMask; return OwnerMask;
// Estate users should be able to edit anything in the sim // Estate users should be able to edit anything in the sim
@ -235,8 +237,8 @@ namespace OpenSim.Region.Environment
permission = true; permission = true;
// Users should be able to edit what is over their land. // Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
user) if (parcel != null && parcel.landData.ownerID == user)
permission = true; permission = true;
// Estate users should be able to edit anything in the sim // Estate users should be able to edit anything in the sim
@ -399,7 +401,8 @@ namespace OpenSim.Region.Environment
Y = 0; Y = 0;
// Land owner can terraform too // Land owner can terraform too
if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(X, Y))) Land parcel = m_scene.LandManager.getLandObject(X, Y);
if (parcel != null && GenericParcelPermission(user, parcel))
permission = true; permission = true;
if (!permission) if (!permission)
@ -466,7 +469,9 @@ namespace OpenSim.Region.Environment
protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos)
{ {
return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y)); Land parcel = m_scene.LandManager.getLandObject(pos.X, pos.Y);
if (parcel == null) return false;
return GenericParcelPermission(user, parcel);
} }
public virtual bool CanEditParcel(LLUUID user, Land parcel) public virtual bool CanEditParcel(LLUUID user, Land parcel)

View File

@ -103,7 +103,10 @@ namespace OpenSim.Region.ExtensionsScriptModule
{ {
Vector myPosition = Task.AbsolutePosition; Vector myPosition = Task.AbsolutePosition;
Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
if (myParcel == null)
{
//Dont do anything!
}
MainLog.Instance.Warn("script", MainLog.Instance.Warn("script",
"Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
return; return;