From 5a26dc2743f176cc5f5fad0ae93aa8187a399f13 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 27 Jan 2011 18:48:48 +0000 Subject: [PATCH] Fix OAR parcel loading so that old parcels are replaced by the new instead of merged. The --merge switch will still merge the old and new land parcelling. --- .../World/Archiver/ArchiveReadRequest.cs | 4 ++++ .../CoreModules/World/Land/LandChannel.cs | 6 ++++++ .../World/Land/LandManagementModule.cs | 19 +++++++++++++++++++ .../Framework/Interfaces/ILandChannel.cs | 5 +++++ .../RegionCombinerLargeLandChannel.cs | 5 +++++ OpenSim/Tests/Common/Mock/TestLandChannel.cs | 5 +++++ 6 files changed, 44 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 3238a8160e..6a96d873eb 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -230,6 +230,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; landData.Add(parcel); } + + if (!m_merge) + m_scene.LandChannel.Clear(); + m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 9e27ef07f8..2959eb4bcf 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -116,6 +116,12 @@ namespace OpenSim.Region.CoreModules.World.Land return new List(); } + + public void Clear() + { + if (m_landManagementModule != null) + m_landManagementModule.Clear(); + } public List ParcelsNearPoint(Vector3 position) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 4db28e2c82..bee223abb3 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -636,6 +636,25 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.Remove(local_id); } } + + /// + /// Clear the scene of all parcels + /// + public void Clear() + { + lock (m_landList) + { + foreach (ILandObject lo in m_landList.Values) + { + //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); + m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); + } + + m_landList.Clear(); + } + + ResetSimLandObjects(); + } private void performFinalLandJoin(ILandObject master, ILandObject slave) { diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs index 20b8ab6b6d..17570c6593 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs @@ -69,6 +69,11 @@ namespace OpenSim.Region.Framework.Interfaces /// ILandObject GetLandObject(int localID); + /// + /// Clear the land channel of all parcels. + /// + void Clear(); + bool IsLandPrimCountTainted(); bool IsForcefulBansAllowed(); void UpdateLandObject(int localID, LandData data); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index be5411a34b..c2480b735b 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -62,6 +62,11 @@ public class RegionCombinerLargeLandChannel : ILandChannel { return RootRegionLandChannel.AllParcels(); } + + public void Clear() + { + RootRegionLandChannel.Clear(); + } public ILandObject GetLandObject(int x, int y) { diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 159764cff8..366af67dc4 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -55,6 +55,11 @@ namespace OpenSim.Tests.Common.Mock { return new List(); } + + public void Clear() + { + // Intentionally blank since we don't save any parcel data in the test channel + } protected ILandObject GetNoLand() {