*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,12 +287,15 @@ 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 != null)
{
if (over.landData.localID == landData.localID) if (over.landData.localID == landData.localID)
{ {
sendLandUpdateToClient(avatars[i].ControllingClient); sendLandUpdateToClient(avatars[i].ControllingClient);
} }
} }
} }
}
#endregion #endregion

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,12 +364,15 @@ 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 (p != null)
{
if (!selectedLandObjects.Contains(p)) if (!selectedLandObjects.Contains(p))
{ {
selectedLandObjects.Add(p); selectedLandObjects.Add(p);
} }
} }
} }
}
Land masterLandObject = selectedLandObjects[0]; Land masterLandObject = selectedLandObjects[0];
selectedLandObjects.RemoveAt(0); selectedLandObjects.RemoveAt(0);
@ -429,7 +430,8 @@ 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) if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
{ {
//Owner Flag //Owner Flag
@ -455,11 +457,14 @@ namespace OpenSim.Region.Environment.LandManagement
//Now for border control //Now for border control
Land westParcel = getLandObject((x - 1) * 4, y * 4);
Land southParcel = getLandObject(x * 4, (y - 1) * 4);
if (x == 0) if (x == 0)
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
} }
else if (getLandObject((x - 1)*4, y*4) != currentParcelBlock) else if (westParcel != null && westParcel != currentParcelBlock)
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
} }
@ -468,7 +473,7 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
} }
else if (getLandObject(x*4, (y - 1)*4) != currentParcelBlock) else if (southParcel != null && southParcel != currentParcelBlock)
{ {
tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
} }
@ -488,6 +493,7 @@ namespace OpenSim.Region.Environment.LandManagement
} }
} }
} }
}
public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
bool snap_selection, IClientAPI remote_client) bool snap_selection, IClientAPI remote_client)
@ -502,6 +508,8 @@ 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 (currentParcel != null)
{
if (!temp.Contains(currentParcel)) if (!temp.Contains(currentParcel))
{ {
currentParcel.forceUpdateLandInfo(); currentParcel.forceUpdateLandInfo();
@ -509,6 +517,7 @@ namespace OpenSim.Region.Environment.LandManagement
} }
} }
} }
}
int requestResult = LAND_RESULT_SINGLE; int requestResult = LAND_RESULT_SINGLE;
if (temp.Count > 1) if (temp.Count > 1)
@ -583,12 +592,15 @@ 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 (check != null)
{
if (!parcelsNear.Contains(check)) if (!parcelsNear.Contains(check))
{ {
parcelsNear.Add(check); parcelsNear.Add(check);
} }
} }
} }
}
return parcelsNear; return parcelsNear;
@ -693,6 +705,8 @@ 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 (parcel != null)
{
if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
{ {
@ -708,10 +722,13 @@ 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 != null)
{
if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) 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); avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
@ -719,6 +736,7 @@ namespace OpenSim.Region.Environment.LandManagement
} }
} }
}
public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client) public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client)

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;