From be3685b1a2ef8ebab25739fc5a5d632ed7359728 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 27 Jan 2011 20:29:06 +0000 Subject: When an oar is loaded, do not create a default parcel before loading the parcels from the OAR. The region spanning parcel shouldn't exist in this situation. If it does, when the land data is loaded it is repersisted with a local ID which comes after the ones loaded via the oar, which obliterates the oar loaded one. Resaving the data we just loaded from the database is somewhat odd in itself (though this makes sense from the way that OAR loading was already using the same event). --- .../World/Archiver/ArchiveReadRequest.cs | 2 +- .../Region/CoreModules/World/Land/LandChannel.cs | 4 ++-- .../CoreModules/World/Land/LandManagementModule.cs | 23 ++++++++++++++-------- .../Region/Framework/Interfaces/ILandChannel.cs | 5 ++++- .../RegionCombinerLargeLandChannel.cs | 4 ++-- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 2d2772b..44fd994 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver } if (!m_merge) - m_scene.LandChannel.Clear(); + 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 2959eb4..7d990c2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -117,10 +117,10 @@ namespace OpenSim.Region.CoreModules.World.Land return new List(); } - public void Clear() + public void Clear(bool setupDefaultParcel) { if (m_landManagementModule != null) - m_landManagementModule.Clear(); + 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 7d030c7..a46be13 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -298,13 +298,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() @@ -640,7 +646,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// /// Clear the scene of all parcels /// - public void Clear() + public void Clear(bool setupDefaultParcel) { lock (m_landList) { @@ -654,6 +660,9 @@ namespace OpenSim.Region.CoreModules.World.Land } ResetSimLandObjects(); + + if (setupDefaultParcel) + CreateDefaultParcel(); } private void performFinalLandJoin(ILandObject master, ILandObject slave) @@ -1321,7 +1330,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } - void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) { ILandObject land; @@ -1337,10 +1345,8 @@ namespace OpenSim.Region.CoreModules.World.Land { land.DeedToGroup(groupID); } - } - #region Land Object From Storage Functions public void EventManagerOnIncomingLandDataFromStorage(List data) @@ -1375,6 +1381,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnNoLandDataFromStorage() { ResetSimLandObjects(); + CreateDefaultParcel(); } #endregion @@ -1646,7 +1653,7 @@ namespace OpenSim.Region.CoreModules.World.Land protected void ClearCommand(Object[] args) { - Clear(); + Clear(true); MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); } diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs index 17570c6..30bae16 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs @@ -72,7 +72,10 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Clear the land channel of all parcels. /// - void Clear(); + /// + /// If true, set up a default parcel covering the whole region owned by the estate owner. + /// + void Clear(bool setupDefaultParcel); bool IsLandPrimCountTainted(); bool IsForcefulBansAllowed(); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index c2480b7..98e5453 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -63,9 +63,9 @@ public class RegionCombinerLargeLandChannel : ILandChannel return RootRegionLandChannel.AllParcels(); } - public void Clear() + public void Clear(bool setupDefaultParcel) { - RootRegionLandChannel.Clear(); + 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 366af67..c3134b3 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -56,7 +56,7 @@ namespace OpenSim.Tests.Common.Mock return new List(); } - public void Clear() + public void Clear(bool setupDefaultParcel) { // Intentionally blank since we don't save any parcel data in the test channel } -- cgit v1.1