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

@ -347,12 +347,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
landData.Add(parcel);
}
if (!m_merge)
m_scene.LandChannel.Clear(false);
if (!m_merge)
{
bool setupDefaultParcel = (landData.Count == 0);
m_scene.LandChannel.Clear(setupDefaultParcel);
}
m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
}
/// <summary>

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

@ -668,14 +668,14 @@ namespace OpenSim.Region.CoreModules.World.Land
//m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID);
m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
}
m_landList.Clear();
ResetSimLandObjects();
if (setupDefaultParcel)
CreateDefaultParcel();
}
ResetSimLandObjects();
if (setupDefaultParcel)
CreateDefaultParcel();
}
private void performFinalLandJoin(ILandObject master, ILandObject slave)
@ -1391,8 +1391,11 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnNoLandDataFromStorage()
{
ResetSimLandObjects();
CreateDefaultParcel();
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()