From b0f641fa157a04b13b3ea16a33feb3cca6a90846 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 27 Jan 2011 05:46:31 +0100 Subject: [PATCH 1/6] Make it work --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8edf3d3bb8..dc08b4954c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2488,6 +2488,8 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); m_eventManager.TriggerOnNewPresence(sp); + sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; + // HERE!!! Do the initial attachments right here // first agent upon login is a root agent by design. // All other AddNewClient calls find aCircuit.child to be true @@ -3267,6 +3269,10 @@ namespace OpenSim.Region.Framework.Scenes } else { + // Let the SP know how we got here. This has a lot of interesting + // uses down the line. + sp.TeleportFlags = (TeleportFlags)teleportFlags; + if (sp.IsChildAgent) { m_log.DebugFormat( @@ -3279,10 +3285,6 @@ namespace OpenSim.Region.Framework.Scenes } - // Let the SP know how we got here. This has a lot of interesting - // uses down the line. - sp.TeleportFlags = (TeleportFlags)teleportFlags; - // In all cases, add or update the circuit data with the new agent circuit data and teleport flags agent.teleportFlags = teleportFlags; m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); From e33cb3db93d096c7d704f60baffb4298438cb6fa Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 27 Jan 2011 16:50:41 +0000 Subject: [PATCH 2/6] remove unused CreateBaseLand() --- .../CoreModules/World/Land/LandManagementModule.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 70767f7b4c..4db28e2c82 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -577,15 +577,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 /// 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 3/6] 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() { From ab9a0f2f1db66a8d7d6957ea0caee13465334a9c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 27 Jan 2011 19:37:20 +0000 Subject: [PATCH 4/6] Add "land clear" command This clears all parcels from the currently selected region and replaces them with the single region spanning default parcel owned by the estate owner --- .../World/Land/LandManagementModule.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index bee223abb3..8ef29023c9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1632,14 +1632,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(); + + MainConsole.Instance.Output("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); + } protected void ShowParcelsCommand(Object[] args) { From 42c0dbf49aba21a473041bb3f0a9073be6269016 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 27 Jan 2011 20:11:30 +0000 Subject: [PATCH 5/6] Show local IDs in "land show" output. Also properly insert region name in "land clear" command --- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 5 +++++ .../CoreModules/World/Land/LandManagementModule.cs | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 6a96d873eb..2d2772bef5 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -228,6 +228,11 @@ 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); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 8ef29023c9..7d030c7a16 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1648,7 +1648,7 @@ namespace OpenSim.Region.CoreModules.World.Land { Clear(); - MainConsole.Instance.Output("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); + MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); } protected void ShowParcelsCommand(Object[] args) @@ -1657,8 +1657,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", @@ -1671,12 +1672,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()); - } + } } } \ No newline at end of file From be3685b1a2ef8ebab25739fc5a5d632ed7359728 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 27 Jan 2011 20:29:06 +0000 Subject: [PATCH 6/6] 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 +- .../CoreModules/World/Land/LandChannel.cs | 4 ++-- .../World/Land/LandManagementModule.cs | 23 ++++++++++++------- .../Framework/Interfaces/ILandChannel.cs | 5 +++- .../RegionCombinerLargeLandChannel.cs | 4 ++-- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 2d2772bef5..44fd994245 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 2959eb4bcf..7d990c265c 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 7d030c7a16..a46be13557 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 17570c6593..30bae16d81 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 c2480b735b..98e5453d1e 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 366af67dc4..c3134b3bc1 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 }