When loading an OAR that doesn't have parcels, create a default parcel

bulletsim
Oren Hurvitz 2011-05-12 14:42:28 +03:00 committed by Justin Clark-Casey (justincc)
parent cb6cd3714e
commit 64d868fb64
4 changed files with 31 additions and 14 deletions

View File

@ -349,7 +349,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
if (!m_merge)
m_scene.LandChannel.Clear(false);
{
bool setupDefaultParcel = (landData.Count == 0);
m_scene.LandChannel.Clear(setupDefaultParcel);
}
m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);

View File

@ -313,6 +313,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels");
// Temporary
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}

View File

@ -670,13 +670,13 @@ namespace OpenSim.Region.CoreModules.World.Land
}
m_landList.Clear();
}
ResetSimLandObjects();
if (setupDefaultParcel)
CreateDefaultParcel();
}
}
private void performFinalLandJoin(ILandObject master, ILandObject slave)
{
@ -1390,10 +1390,13 @@ namespace OpenSim.Region.CoreModules.World.Land
}
public void EventManagerOnNoLandDataFromStorage()
{
lock (m_landList)
{
ResetSimLandObjects();
CreateDefaultParcel();
}
}
#endregion

View File

@ -40,10 +40,12 @@ namespace OpenSim.Tests.Common.Mock
public class TestLandChannel : ILandChannel
{
private Scene m_scene;
private List<ILandObject> m_parcels;
public TestLandChannel(Scene scene)
{
m_scene = scene;
m_parcels = new List<ILandObject>();
}
public List<ILandObject> ParcelsNearPoint(Vector3 position)
@ -53,12 +55,19 @@ namespace OpenSim.Tests.Common.Mock
public List<ILandObject> AllParcels()
{
return new List<ILandObject>();
return m_parcels;
}
public void Clear(bool setupDefaultParcel)
{
// Intentionally blank since we don't save any parcel data in the test channel
m_parcels.Clear();
if (setupDefaultParcel)
{
ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
obj.LandData.Name = "Your Parcel";
m_parcels.Add(obj);
}
}
protected ILandObject GetNoLand()