Remove try/catch in LandManagmentModule.GetLandObject() - this is very old code and the caught exceptions can no longer occur.
parent
3c05d67094
commit
8225e3f40c
|
@ -865,86 +865,67 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
lock (m_landIDList)
|
lock (m_landIDList)
|
||||||
{
|
{
|
||||||
try
|
int landID = m_landIDList[x / LandUnit, y / LandUnit];
|
||||||
|
if (landID == 0)
|
||||||
{
|
{
|
||||||
int landID = m_landIDList[x / LandUnit, y / LandUnit];
|
// Zero is the uninitialized value saying there is no parcel for this location.
|
||||||
if (landID == 0)
|
// This sometimes happens when terrain is resized.
|
||||||
|
if (m_landList.Count == 1)
|
||||||
{
|
{
|
||||||
// Zero is the uninitialized value saying there is no parcel for this location.
|
m_log.DebugFormat(
|
||||||
// This sometimes happens when terrain is resized.
|
"[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
|
||||||
if (m_landList.Count == 1)
|
LogHeader, x, y, m_scene.Name);
|
||||||
|
|
||||||
|
int onlyParcelID = 0;
|
||||||
|
ILandObject onlyLandObject = null;
|
||||||
|
foreach (KeyValuePair<int, ILandObject> kvp in m_landList)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
onlyParcelID = kvp.Key;
|
||||||
"[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
|
onlyLandObject = kvp.Value;
|
||||||
LogHeader, x, y, m_scene.Name);
|
break;
|
||||||
|
|
||||||
int onlyParcelID = 0;
|
|
||||||
ILandObject onlyLandObject = null;
|
|
||||||
foreach (KeyValuePair<int, ILandObject> kvp in m_landList)
|
|
||||||
{
|
|
||||||
onlyParcelID = kvp.Key;
|
|
||||||
onlyLandObject = kvp.Value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There is only one parcel. Grow it to fill all the unallocated spaces.
|
|
||||||
for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
|
|
||||||
for (int yy = 0; yy < m_landIDList.GetLength(1); yy++)
|
|
||||||
if (m_landIDList[xx, yy] == 0)
|
|
||||||
m_landIDList[xx, yy] = onlyParcelID;
|
|
||||||
|
|
||||||
onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID);
|
|
||||||
landID = onlyParcelID;
|
|
||||||
}
|
}
|
||||||
else if (m_landList.Count > 1)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[{0}]: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
|
|
||||||
LogHeader, x, y, m_scene.Name);
|
|
||||||
|
|
||||||
// There are several other parcels so we must create a new one for the unassigned space
|
// There is only one parcel. Grow it to fill all the unallocated spaces.
|
||||||
ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
|
for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
|
||||||
// Claim all the unclaimed "0" ids
|
for (int yy = 0; yy < m_landIDList.GetLength(1); yy++)
|
||||||
newLand.SetLandBitmap(CreateBitmapForID(0));
|
if (m_landIDList[xx, yy] == 0)
|
||||||
newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
m_landIDList[xx, yy] = onlyParcelID;
|
||||||
newLand.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
|
|
||||||
newLand = AddLandObject(newLand);
|
|
||||||
|
|
||||||
if (newLand == null)
|
onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID);
|
||||||
return null;
|
landID = onlyParcelID;
|
||||||
|
|
||||||
landID = m_lastLandLocalID;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// XXX: We're not currently doing anything if there are no parcels, as this might indicate a race
|
|
||||||
// condition where this method is being called before land data is loaded. May need to address
|
|
||||||
// this in another way.
|
|
||||||
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[{0}]: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
|
|
||||||
LogHeader, m_scene.Name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (m_landList.Count > 1)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[{0}]: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
|
||||||
|
LogHeader, x, y, m_scene.Name);
|
||||||
|
|
||||||
ret = m_landList[landID];
|
// There are several other parcels so we must create a new one for the unassigned space
|
||||||
}
|
ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
|
||||||
catch (IndexOutOfRangeException)
|
// Claim all the unclaimed "0" ids
|
||||||
{
|
newLand.SetLandBitmap(CreateBitmapForID(0));
|
||||||
m_log.ErrorFormat(
|
newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
"{0} GetLandObject: Tried to retrieve land object from out of bounds co-ordinate ({1},{2}) in {3}. landListSize=({4},{5})",
|
newLand.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
|
||||||
LogHeader, x, y, m_scene.RegionInfo.RegionName, m_landIDList.GetLength(0), m_landIDList.GetLength(1));
|
newLand = AddLandObject(newLand);
|
||||||
|
|
||||||
return null;
|
if (newLand == null)
|
||||||
}
|
return null;
|
||||||
catch
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"{0} GetLandObject: LandID not in landlist. XY=<{1},{2}> in {3}. landID[x,y]={4}",
|
|
||||||
LogHeader, x, y, m_scene.RegionInfo.RegionName, m_landIDList[x/LandUnit, y/LandUnit]);
|
|
||||||
|
|
||||||
return null;
|
landID = m_lastLandLocalID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// XXX: We're not currently doing anything if there are no parcels, as this might indicate a race
|
||||||
|
// condition where this method is being called before land data is loaded. May need to address
|
||||||
|
// this in another way.
|
||||||
|
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[{0}]: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
|
||||||
|
LogHeader, m_scene.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = m_landList[landID];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue