From 81c439bcaadee10a89e74cb65217c7910d943741 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 Nov 2009 20:36:00 +0000 Subject: [PATCH] Patch from Snoopy2. Fixes Mantis #4342 fixes problems when group owned land was abandoned by the land owner or reclaimed by the estate manager or by god. Beside that this new patch makes it possible, that users can buy land directly for a group, if the buyer has the required permissions. --- .../World/Land/LandManagementModule.cs | 11 +++-- .../CoreModules/World/Land/LandObject.cs | 40 ++++++++++++++++--- .../Framework/Interfaces/ILandObject.cs | 1 + 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 93a949a249..968f46a50f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1059,9 +1059,11 @@ namespace OpenSim.Region.CoreModules.World.Land if (m_scene.Permissions.IsGod(remote_client.AgentId)) { land.LandData.OwnerID = ownerID; + land.LandData.GroupID = UUID.Zero; + land.LandData.IsGroupOwned = false; m_scene.ForEachClient(SendParcelOverlay); - land.SendLandUpdateToClient(remote_client); + land.SendLandUpdateToClient(true, remote_client); } } } @@ -1082,8 +1084,10 @@ namespace OpenSim.Region.CoreModules.World.Land land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; else land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; + land.LandData.GroupID = UUID.Zero; + land.LandData.IsGroupOwned = false; m_scene.ForEachClient(SendParcelOverlay); - land.SendLandUpdateToClient(remote_client); + land.SendLandUpdateToClient(true, remote_client); } } } @@ -1105,9 +1109,10 @@ namespace OpenSim.Region.CoreModules.World.Land else land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; land.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); + land.LandData.GroupID = UUID.Zero; land.LandData.IsGroupOwned = false; m_scene.ForEachClient(SendParcelOverlay); - land.SendLandUpdateToClient(remote_client); + land.SendLandUpdateToClient(true, remote_client); } } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index bfe85f1e04..0bd225ebe4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -49,6 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Land #pragma warning restore 0429 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; + private int m_lastSeqId = 0; + protected LandData m_landData = new LandData(); protected Scene m_scene; protected List primsOverMe = new List(); @@ -81,6 +83,10 @@ namespace OpenSim.Region.CoreModules.World.Land { m_scene = scene; LandData.OwnerID = owner_id; + if (is_group_owned) + LandData.GroupID = owner_id; + else + LandData.GroupID = UUID.Zero; LandData.IsGroupOwned = is_group_owned; } @@ -172,7 +178,19 @@ namespace OpenSim.Region.CoreModules.World.Land // regionFlags |= (uint)RegionFlags.AllowLandmark; // if (landData.OwnerID == remote_client.AgentId) // regionFlags |= (uint)RegionFlags.AllowSetHome; - remote_client.SendLandProperties(sequence_id, + + int seq_id; + if (snap_selection && (sequence_id == 0)) + { + seq_id = m_lastSeqId; + } + else + { + seq_id = sequence_id; + m_lastSeqId = seq_id; + } + + remote_client.SendLandProperties(seq_id, snap_selection, request_result, LandData, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, GetParcelMaxPrimCount(this), @@ -184,6 +202,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) { //Needs later group support + bool snap_selection = false; LandData newData = LandData.Copy(); if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) @@ -192,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land { newData.AuthBuyerID = args.AuthBuyerID; newData.SalePrice = args.SalePrice; + snap_selection = true; } } newData.Category = args.Category; @@ -212,7 +232,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); - SendLandUpdateToAvatarsOverMe(); + SendLandUpdateToAvatarsOverMe(snap_selection); } } @@ -230,7 +250,7 @@ namespace OpenSim.Region.CoreModules.World.Land newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); - SendLandUpdateToAvatarsOverMe(); + SendLandUpdateToAvatarsOverMe(true); } public void DeedToGroup(UUID groupID) @@ -242,7 +262,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); - SendLandUpdateToAvatarsOverMe(); + SendLandUpdateToAvatarsOverMe(true); } public bool IsEitherBannedOrRestricted(UUID avatar) @@ -297,7 +317,17 @@ namespace OpenSim.Region.CoreModules.World.Land SendLandProperties(0, false, 0, remote_client); } + public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) + { + SendLandProperties(0, snap_selection, 0, remote_client); + } + public void SendLandUpdateToAvatarsOverMe() + { + SendLandUpdateToAvatarsOverMe(false); + } + + public void SendLandUpdateToAvatarsOverMe(bool snap_selection) { List avatars = m_scene.GetAvatars(); ILandObject over = null; @@ -325,7 +355,7 @@ namespace OpenSim.Region.CoreModules.World.Land else avatars[i].Invulnerable = true; - SendLandUpdateToClient(avatars[i].ControllingClient); + SendLandUpdateToClient(snap_selection, avatars[i].ControllingClient); } } } diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs index c2b1292864..084184ffb4 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs @@ -54,6 +54,7 @@ namespace OpenSim.Region.Framework.Interfaces bool IsBannedFromLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar); void SendLandUpdateToClient(IClientAPI remote_client); + void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); List CreateAccessListArrayByFlag(AccessList flag); void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); void UpdateAccessList(uint flags, List entries, IClientAPI remote_client);