*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)
{
if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0)
@ -274,12 +287,15 @@ namespace OpenSim.Region.Environment.LandManagement
Land over =
m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X),
(int) Math.Round(avatars[i].AbsolutePosition.Y));
if (over != null)
{
if (over.landData.localID == landData.localID)
{
sendLandUpdateToClient(avatars[i].ControllingClient);
}
}
}
}
#endregion

View File

@ -192,7 +192,8 @@ namespace OpenSim.Region.Environment.LandManagement
{
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
{
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)
{
// These exceptions here will cause a lot of complaints from the users specifically because
// they happen every time at border crossings
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
return null;
}
else
{
@ -366,12 +364,15 @@ namespace OpenSim.Region.Environment.LandManagement
for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
{
Land p = getLandObject(stepXSelected, stepYSelected);
if (p != null)
{
if (!selectedLandObjects.Contains(p))
{
selectedLandObjects.Add(p);
}
}
}
}
Land masterLandObject = selectedLandObjects[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
Land currentParcelBlock = getLandObject(x*4, y*4);
if (currentParcelBlock != null)
{
if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
{
//Owner Flag
@ -455,11 +457,14 @@ namespace OpenSim.Region.Environment.LandManagement
//Now for border control
Land westParcel = getLandObject((x - 1) * 4, y * 4);
Land southParcel = getLandObject(x * 4, (y - 1) * 4);
if (x == 0)
{
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);
}
@ -468,7 +473,7 @@ namespace OpenSim.Region.Environment.LandManagement
{
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);
}
@ -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,
bool snap_selection, IClientAPI remote_client)
@ -502,6 +508,8 @@ namespace OpenSim.Region.Environment.LandManagement
for (y = 0; y < inc_y; y++)
{
Land currentParcel = getLandObject(start_x + x, start_y + y);
if (currentParcel != null)
{
if (!temp.Contains(currentParcel))
{
currentParcel.forceUpdateLandInfo();
@ -509,6 +517,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
}
}
}
int requestResult = LAND_RESULT_SINGLE;
if (temp.Count > 1)
@ -583,12 +592,15 @@ namespace OpenSim.Region.Environment.LandManagement
for (y = -4; y <= 4; y += 4)
{
Land check = getLandObject(position.X + x, position.Y + y);
if (check != null)
{
if (!parcelsNear.Contains(check))
{
parcelsNear.Add(check);
}
}
}
}
return parcelsNear;
@ -693,6 +705,8 @@ namespace OpenSim.Region.Environment.LandManagement
sendLandUpdate(clientAvatar);
sendOutNearestBanLine(remote_client);
Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
if (parcel != null)
{
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.
{
Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (over != null)
{
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);
@ -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)

View File

@ -110,6 +110,8 @@ namespace OpenSim.Region.Environment
string reason = "Insufficient permission";
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)
permission = true;
@ -176,8 +178,8 @@ namespace OpenSim.Region.Environment
return OwnerMask;
// Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID ==
user)
Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
return OwnerMask;
// Estate users should be able to edit anything in the sim
@ -235,8 +237,8 @@ namespace OpenSim.Region.Environment
permission = true;
// Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID ==
user)
Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
permission = true;
// Estate users should be able to edit anything in the sim
@ -399,7 +401,8 @@ namespace OpenSim.Region.Environment
Y = 0;
// 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;
if (!permission)
@ -466,7 +469,9 @@ namespace OpenSim.Region.Environment
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)

View File

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