Only auto-create a land parcel when there is none in a specified tile if there is more than 1 existing land parcel.

This is because there are still issues with bad parcels being generated in http://opensimulator.org/mantis/view.php?id=7035
Theorizing now that it's possible that something is calling GetParcel() before any parcel data has been loaded from persistence.
0.8.0.3
Justin Clark-Casey (justincc) 2014-03-07 01:23:19 +00:00
parent 71918eeab4
commit 6b7625a56b
1 changed files with 13 additions and 1 deletions

View File

@ -874,6 +874,10 @@ namespace OpenSim.Region.CoreModules.World.Land
// This sometimes happens when terrain is resized. // This sometimes happens when terrain is resized.
if (m_landList.Count == 1) if (m_landList.Count == 1)
{ {
m_log.DebugFormat(
"[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
LogHeader, x, y, m_scene.Name);
int onlyParcelID = 0; int onlyParcelID = 0;
ILandObject onlyLandObject = null; ILandObject onlyLandObject = null;
foreach (KeyValuePair<int, ILandObject> kvp in m_landList) foreach (KeyValuePair<int, ILandObject> kvp in m_landList)
@ -892,8 +896,12 @@ namespace OpenSim.Region.CoreModules.World.Land
onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID); onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID);
landID = onlyParcelID; landID = onlyParcelID;
} }
else 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 are several other parcels so we must create a new one for the unassigned space
ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
// Claim all the unclaimed "0" ids // Claim all the unclaimed "0" ids
@ -907,6 +915,10 @@ namespace OpenSim.Region.CoreModules.World.Land
landID = m_lastLandLocalID; landID = m_lastLandLocalID;
} }
// 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.
} }
ret = m_landList[landID]; ret = m_landList[landID];