diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index d948b8285b..29d07135d8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -228,8 +228,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); if (!ResolveUserUuid(parcel.OwnerID)) parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; + +// m_log.DebugFormat( +// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}", +// parcel.Name, parcel.LocalID, parcel.Area); + landData.Add(parcel); } + + if (!m_merge) + m_scene.LandChannel.Clear(false); + 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..7d990c265c 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(bool setupDefaultParcel) + { + if (m_landManagementModule != null) + m_landManagementModule.Clear(setupDefaultParcel); + } public List ParcelsNearPoint(Vector3 position) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index cb8c5de670..a4e85d6390 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -306,13 +306,19 @@ namespace OpenSim.Region.CoreModules.World.Land m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; m_landIDList.Initialize(); } - + } + + /// + /// Create a default parcel that spans the entire region and is owned by the estate owner. + /// + /// The parcel created. + protected ILandObject CreateDefaultParcel() + { ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); - fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); - AddLandObject(fullSimParcel); + return AddLandObject(fullSimParcel); } public List AllParcels() @@ -585,15 +591,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } - /// - /// Creates a basic Parcel object without an owner (a zeroed key) - /// - /// - public ILandObject CreateBaseLand() - { - return new LandObject(UUID.Zero, false, m_scene); - } - /// /// Adds a land object to the stored list and adds them to the landIDList to what they own /// @@ -653,6 +650,28 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.Remove(local_id); } } + + /// + /// Clear the scene of all parcels + /// + public void Clear(bool setupDefaultParcel) + { + 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(); + + if (setupDefaultParcel) + CreateDefaultParcel(); + } private void performFinalLandJoin(ILandObject master, ILandObject slave) { @@ -1323,7 +1342,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } - void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) { ILandObject land; @@ -1342,7 +1360,6 @@ namespace OpenSim.Region.CoreModules.World.Land EventManagerOnParcelPrimCountTainted(); } - #region Land Object From Storage Functions public void EventManagerOnIncomingLandDataFromStorage(List data) @@ -1390,6 +1407,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnNoLandDataFromStorage() { ResetSimLandObjects(); + CreateDefaultParcel(); } #endregion @@ -1963,14 +1981,24 @@ namespace OpenSim.Region.CoreModules.World.Land protected void InstallInterfaces() { - Command showCommand = - new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the current region."); + Command clearCommand + = new Command("clear", CommandIntentions.COMMAND_HAZARDOUS, ClearCommand, "Clears all the parcels from the region."); + Command showCommand + = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the region."); + m_commander.RegisterCommand("clear", clearCommand); m_commander.RegisterCommand("show", showCommand); // Add this to our scene so scripts can call these functions m_scene.RegisterModuleCommander(m_commander); - } + } + + protected void ClearCommand(Object[] args) + { + Clear(true); + + MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); + } protected void ShowParcelsCommand(Object[] args) { @@ -1978,8 +2006,9 @@ namespace OpenSim.Region.CoreModules.World.Land report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); report.AppendFormat( - "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", + "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", "Parcel Name", + "Local ID", "Area", "Starts", "Ends", @@ -1992,12 +2021,12 @@ namespace OpenSim.Region.CoreModules.World.Land LandData ld = lo.LandData; report.AppendFormat( - "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", - ld.Name, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); + "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", + ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); } } MainConsole.Instance.Output(report.ToString()); - } + } } } diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs index 20b8ab6b6d..30bae16d81 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs @@ -69,6 +69,14 @@ namespace OpenSim.Region.Framework.Interfaces /// ILandObject GetLandObject(int localID); + /// + /// Clear the land channel of all parcels. + /// + /// + /// If true, set up a default parcel covering the whole region owned by the estate owner. + /// + void Clear(bool setupDefaultParcel); + 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..98e5453d1e 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(bool setupDefaultParcel) + { + RootRegionLandChannel.Clear(setupDefaultParcel); + } 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..c3134b3bc1 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(bool setupDefaultParcel) + { + // Intentionally blank since we don't save any parcel data in the test channel + } protected ILandObject GetNoLand() {