diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 302f7aeb59..ca7566e209 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1267,7 +1267,7 @@ namespace OpenSim.Client.MXP.ClientStack // Need to translate to MXP somehow } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { // Need to translate to MXP somehow } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index ba6456b571..120e2eaafb 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -805,7 +805,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack throw new System.NotImplementedException(); } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 3f7709296d..6ec69d313c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1148,7 +1148,17 @@ namespace OpenSim.Framework void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner); - void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, + /// + /// Send land properties to the client. + /// + /// + /// + /// + /// + /// /param> + /// + /// + void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags); diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs similarity index 100% rename from OpenSim/Region/Framework/Interfaces/ILandChannel.cs rename to OpenSim/Framework/ILandChannel.cs diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Framework/ILandObject.cs similarity index 95% rename from OpenSim/Region/Framework/Interfaces/ILandObject.cs rename to OpenSim/Framework/ILandObject.cs index 9c0abdeedc..931e24aebb 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -27,10 +27,8 @@ using System.Collections.Generic; using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Scenes; -namespace OpenSim.Region.Framework.Interfaces +namespace OpenSim.Framework { public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); @@ -90,11 +88,8 @@ namespace OpenSim.Region.Framework.Interfaces bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client); void SendLandObjectOwners(IClientAPI remote_client); - void ReturnObject(SceneObjectGroup obj); void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); void ResetLandPrimCounts(); - void AddPrimToCount(SceneObjectGroup obj); - void RemovePrimFromCount(SceneObjectGroup obj); void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); void DeedToGroup(UUID groupID); diff --git a/OpenSim/Framework/IPrimCounts.cs b/OpenSim/Framework/IPrimCounts.cs new file mode 100644 index 0000000000..3e12348e1b --- /dev/null +++ b/OpenSim/Framework/IPrimCounts.cs @@ -0,0 +1,74 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public interface IPrimCounts + { + /// + /// Parcel owner owned prims + /// + int Owner { get; } + + /// + /// Parcel group owned prims + /// + int Group { get; } + + /// + /// Prims owned by others (not parcel owner or parcel group). + /// + int Others { get; } + + /// + /// Selected prims + /// + int Selected { get; } + + /// + /// Total prims on the parcel. + /// + int Total { get; } + + /// + /// Prims on the simulator that are owned by the parcel owner, even if they are in other parcels. + /// + int Simulator { get; } + + /// + /// Prims per individual users. + /// + IUserPrimCounts Users { get; } + } + + public interface IUserPrimCounts + { + int this[UUID agentID] { get; } + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e91d37f098..311b1e4dc8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4337,8 +4337,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties( + int sequence_id, bool snap_selection, int request_result, ILandObject lo, + float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { +// m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); + + LandData landData = lo.LandData; + ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); updateMessage.AABBMax = landData.AABBMax; @@ -4346,15 +4352,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.Area = landData.Area; updateMessage.AuctionID = landData.AuctionID; updateMessage.AuthBuyerID = landData.AuthBuyerID; - updateMessage.Bitmap = landData.Bitmap; - updateMessage.Desc = landData.Description; updateMessage.Category = landData.Category; updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); updateMessage.ClaimPrice = landData.ClaimPrice; - updateMessage.GroupID = landData.GroupID; - updateMessage.GroupPrims = landData.GroupPrims; + updateMessage.GroupID = landData.GroupID; updateMessage.IsGroupOwned = landData.IsGroupOwned; updateMessage.LandingType = (LandingType) landData.LandingType; updateMessage.LocalID = landData.LocalID; @@ -4375,9 +4378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.Name = landData.Name; updateMessage.OtherCleanTime = landData.OtherCleanTime; updateMessage.OtherCount = 0; //TODO: Unimplemented - updateMessage.OtherPrims = landData.OtherPrims; - updateMessage.OwnerID = landData.OwnerID; - updateMessage.OwnerPrims = landData.OwnerPrims; + updateMessage.OwnerID = landData.OwnerID; updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; updateMessage.ParcelPrimBonus = simObjectBonusFactor; updateMessage.PassHours = landData.PassHours; @@ -4392,10 +4393,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.RentPrice = 0; updateMessage.RequestResult = (ParcelResult) request_result; - updateMessage.SalePrice = landData.SalePrice; - updateMessage.SelectedPrims = landData.SelectedPrims; + updateMessage.SalePrice = landData.SalePrice; updateMessage.SelfCount = 0; //TODO: Unimplemented updateMessage.SequenceID = sequence_id; + if (landData.SimwideArea > 0) { int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); @@ -4405,22 +4406,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP { updateMessage.SimWideMaxPrims = 0; } - updateMessage.SimWideTotalPrims = landData.SimwidePrims; + updateMessage.SnapSelection = snap_selection; - updateMessage.SnapshotID = landData.SnapshotID; - updateMessage.Status = (ParcelStatus) landData.Status; - updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + - landData.SelectedPrims; - updateMessage.UserLocation = landData.UserLocation; - updateMessage.UserLookAt = landData.UserLookAt; + updateMessage.SnapshotID = landData.SnapshotID; + updateMessage.Status = (ParcelStatus) landData.Status; + updateMessage.UserLocation = landData.UserLocation; + updateMessage.UserLookAt = landData.UserLookAt; - updateMessage.MediaType = landData.MediaType; - updateMessage.MediaDesc = landData.MediaDescription; - updateMessage.MediaWidth = landData.MediaWidth; - updateMessage.MediaHeight = landData.MediaHeight; - updateMessage.MediaLoop = landData.MediaLoop; - updateMessage.ObscureMusic = landData.ObscureMusic; - updateMessage.ObscureMedia = landData.ObscureMedia; + updateMessage.MediaType = landData.MediaType; + updateMessage.MediaDesc = landData.MediaDescription; + updateMessage.MediaWidth = landData.MediaWidth; + updateMessage.MediaHeight = landData.MediaHeight; + updateMessage.MediaLoop = landData.MediaLoop; + updateMessage.ObscureMusic = landData.ObscureMusic; + updateMessage.ObscureMedia = landData.ObscureMedia; + + IPrimCounts pc = lo.PrimCounts; + updateMessage.OwnerPrims = pc.Owner; + updateMessage.GroupPrims = pc.Group; + updateMessage.OtherPrims = pc.Others; + updateMessage.SelectedPrims = pc.Selected; + updateMessage.TotalPrims = pc.Total; + updateMessage.SimWideTotalPrims = pc.Simulator; try { @@ -4428,13 +4435,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (eq != null) { eq.ParcelProperties(updateMessage, this.AgentId); - } else { - m_log.Warn("No EQ Interface when sending parcel data."); + } + else + { + m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data."); } } catch (Exception ex) { - m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString()); + m_log.Error("[LLCLIENTVIEW]: Unable to send parcel data via eventqueue - exception: " + ex.ToString()); } } diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a5fcb493bd..0babeb5140 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using Nini.Config; +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenMetaverse; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 50040ff4f7..b5517a1f1a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -722,7 +722,7 @@ namespace OpenSim.Region.CoreModules.World.Land ILandObject landUnderPrim = GetLandObject(position.X, position.Y); if (landUnderPrim != null) { - landUnderPrim.AddPrimToCount(obj); + ((LandObject)landUnderPrim).AddPrimToCount(obj); } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 1e824bd431..e87153bcf2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Land } remote_client.SendLandProperties(seq_id, - snap_selection, request_result, LandData, + snap_selection, request_result, this, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, GetParcelMaxPrimCount(this), GetSimulatorMaxPrimCount(this), regionFlags); diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 62fd2b0126..854d1cab9d 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -45,14 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land public int Owner = 0; public int Group = 0; public int Others = 0; - public Dictionary Users = - new Dictionary (); + public int Selected = 0; + public Dictionary Users = new Dictionary (); } public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { -// private static readonly ILog m_log = -// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -64,7 +63,6 @@ namespace OpenSim.Region.CoreModules.World.Land private Dictionary m_ParcelCounts = new Dictionary(); - /// /// For now, a simple simwide taint to get this up. Later parcel based /// taint to allow recounting a parcel if only ownership has changed @@ -96,6 +94,7 @@ namespace OpenSim.Region.CoreModules.World.Land OnObjectBeingRemovedFromScene; m_Scene.EventManager.OnParcelPrimCountTainted += OnParcelPrimCountTainted; + m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); }; } public void RegionLoaded(Scene scene) @@ -123,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) AddObject(obj); +// else +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", +// obj.Name, m_Scene.RegionInfo.RegionName); + } } @@ -133,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) RemoveObject(obj); +// else +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", +// obj.Name, m_Scene.RegionInfo.RegionName); } } private void OnParcelPrimCountTainted() { +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); + lock (m_TaintLock) m_Tainted = true; } @@ -163,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) { -// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} to prim count", obj.Name); +// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); if (obj.IsAttachment) return; @@ -208,16 +219,25 @@ namespace OpenSim.Region.CoreModules.World.Land else parcelCounts.Others += partCount; } + + if (obj.IsSelected) + parcelCounts.Selected += partCount; } } // NOTE: Call under Taint Lock private void RemoveObject(SceneObjectGroup obj) { +// m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); + + // Currently this is being done by tainting the count instead. } public IPrimCounts GetPrimCounts(UUID parcelID) { +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); + PrimCounts primCounts; lock (m_PrimCounts) @@ -239,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetOwnerCount(UUID parcelID) { -// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); + int count = 0; lock (m_TaintLock) { @@ -248,9 +268,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Owner; + count = counts.Owner; } - return 0; + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -260,6 +285,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetGroupCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -267,9 +294,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Group; + count = counts.Group; } - return 0; + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -279,6 +311,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetOthersCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -286,9 +320,71 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Others; + count = counts.Others; } - return 0; + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; + } + + /// + /// Get the number of selected prims. + /// + /// + /// + public int GetSelectedCount(UUID parcelID) + { + int count = 0; + + lock (m_TaintLock) + { + if (m_Tainted) + Recount(); + + ParcelCounts counts; + if (m_ParcelCounts.TryGetValue(parcelID, out counts)) + count = counts.Selected; + } + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; + } + + /// + /// Get the total count of owner, group and others prims on the parcel. + /// FIXME: Need to do selected prims once this is reimplemented. + /// + /// + /// + public int GetTotalCount(UUID parcelID) + { + int count = 0; + + lock (m_TaintLock) + { + if (m_Tainted) + Recount(); + + ParcelCounts counts; + if (m_ParcelCounts.TryGetValue(parcelID, out counts)) + { + count = counts.Owner; + count += counts.Group; + count += counts.Others; + } + } + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -298,6 +394,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetSimulatorCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -308,10 +406,15 @@ namespace OpenSim.Region.CoreModules.World.Land { int val; if (m_SimwideCounts.TryGetValue(owner, out val)) - return val; + count = val; } } - return 0; + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -322,6 +425,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetUserCount(UUID parcelID, UUID userID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -332,10 +437,15 @@ namespace OpenSim.Region.CoreModules.World.Land { int val; if (counts.Users.TryGetValue(userID, out val)) - return val; + count = val; } } - return 0; + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", +// userID, parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } // NOTE: This method MUST be called while holding the taint lock! @@ -367,6 +477,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (!m_OwnerMap.ContainsKey(k)) m_PrimCounts.Remove(k); } + m_Tainted = false; } } @@ -408,6 +519,22 @@ namespace OpenSim.Region.CoreModules.World.Land return m_Parent.GetOthersCount(m_ParcelID); } } + + public int Selected + { + get + { + return m_Parent.GetSelectedCount(m_ParcelID); + } + } + + public int Total + { + get + { + return m_Parent.GetTotalCount(m_ParcelID); + } + } public int Simulator { diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index c9d393f4d6..5a60f22a48 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -78,9 +78,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(0)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); - Assert.That(pc.Simulator, Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(0)); SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); m_scene.AddNewSceneObject(sog, false); @@ -88,6 +90,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(3)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); @@ -99,11 +103,38 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(5)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(5)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(5)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(5)); } + /// + /// Test count after a parcel owner owned copied object is added. + /// + [Test] + public void TestCopiedOwnerObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); + m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); + + Assert.That(pc.Owner, Is.EqualTo(6)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(6)); + Assert.That(pc.Selected, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(6)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(6)); + } + /// /// Test count after a parcel owner owned object is removed. /// @@ -123,9 +154,35 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(1)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(1)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); - } + } + + /// + /// Test the count is correct after is has been tainted. + /// + [Test] + public void TestTaint() + { + TestHelper.InMethod(); + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); + + m_pcm.TaintPrimCount(); + + Assert.That(pc.Owner, Is.EqualTo(3)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(3)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(3)); + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 6676ec8100..d6fa0937e5 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs @@ -62,9 +62,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders return LoadBitmap(new Bitmap(filename)); } - public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) + public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) { - throw new NotImplementedException(); + Bitmap bitmap = new Bitmap(filename); + ITerrainChannel retval = new TerrainChannel(true); + + for (int x = 0; x < retval.Width; x++) + { + for (int y = 0; y < retval.Height; y++) + { + retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; + } + } + + return retval; } public virtual ITerrainChannel LoadStream(Stream stream) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 282e4f18fa..d0aa53ed14 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -100,9 +100,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region regionInfos = new List(); GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); - if (info != null) regionInfos.Add(info); + if (info != null) + regionInfos.Add(info); } + else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) + remoteClient.SendAlertMessage("Hyperlink could not be established."); + //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); List blocks = new List(); MapBlockData data; diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 5151bf0271..df12d69299 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -914,7 +914,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } diff --git a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs index 65158e1c80..d63da2e2af 100644 --- a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs @@ -38,18 +38,4 @@ namespace OpenSim.Region.Framework.Interfaces IPrimCounts GetPrimCounts(UUID parcelID); } - - public interface IPrimCounts - { - int Owner { get; } - int Group { get; } - int Others { get; } - int Simulator { get; } - IUserPrimCounts Users { get; } - } - - public interface IUserPrimCounts - { - int this[UUID agentID] { get; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index e2574e7ac1..627b58fd77 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1253,7 +1253,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs index 8df020f893..c898da610d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 1ce3791232..227450de66 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -930,7 +930,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } public void SendLandAccessListData(List avatars, uint accessFlag, int localLandID) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index a4aa44d581..b226971950 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -65,6 +65,8 @@ namespace OpenSim.Services.GridService protected UUID m_ScopeID = UUID.Zero; protected bool m_Check4096 = true; protected string m_MapTileDirectory = string.Empty; + protected string m_ThisGatekeeper = string.Empty; + protected Uri m_ThisGatekeeperURI = null; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -123,6 +125,16 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); + m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); + try + { + m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); + } + catch + { + m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); + } + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); @@ -210,6 +222,8 @@ namespace OpenSim.Services.GridService remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); reason = string.Empty; + Uri uri = null; + regInfo = new GridRegion(); if ( externalPort > 0) regInfo.HttpPort = externalPort; @@ -220,8 +234,17 @@ namespace OpenSim.Services.GridService else regInfo.ExternalHostName = "0.0.0.0"; if ( serverURI != null) + { regInfo.ServerURI = serverURI; - + try + { + uri = new Uri(serverURI); + regInfo.ExternalHostName = uri.Host; + regInfo.HttpPort = (uint)uri.Port; + } + catch {} + } + if ( remoteRegionName != string.Empty ) regInfo.RegionName = remoteRegionName; @@ -230,6 +253,18 @@ namespace OpenSim.Services.GridService regInfo.ScopeID = scopeID; regInfo.EstateOwner = ownerID; + // Make sure we're not hyperlinking to regions on this grid! + if (m_ThisGatekeeperURI != null) + { + if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) + { + reason = "Cannot hyperlink to regions on the same grid"; + return false; + } + } + else + m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!"); + // Check for free coordinates GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); if (region != null) diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 7b7d66e9f4..d1b4feb2fb 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -961,7 +961,7 @@ namespace OpenSim.Tests.Common.Mock { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } diff --git a/README.txt b/README.txt index 8d925b5df6..391a6599d1 100644 --- a/README.txt +++ b/README.txt @@ -44,7 +44,7 @@ for more information. To run OpenSim, from the unpacked distribution type: * cd bin - * LD_LIBRARY_PATH=. mono OpenSim.exe + * mono OpenSim.exe Now see the "Configuring OpenSim" section diff --git a/bin/Mono.Data.Sqlite.dll.config b/bin/Mono.Data.Sqlite.dll.config index 0c5e9412f2..6a95476537 100644 --- a/bin/Mono.Data.Sqlite.dll.config +++ b/bin/Mono.Data.Sqlite.dll.config @@ -1,4 +1,4 @@ - - + + diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 4dc0e53342..a6fe4b1092 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -45,6 +45,12 @@ ;; Directory for map tile images of linked regions ; MapTileDirectory = "./maptiles" + ; === HG ONLY === + ;; change this to the address of your Gatekeeper service + ;; (usually bundled with the rest of the services in one + ;; Robust server in port 8002, but not always) + Gatekeeper="http://mygridserver.com:8002" + [AvatarService] ; ; change this to your grid-wide grid server diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 816e9a6f10..995a33e8e1 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -78,6 +78,11 @@ ;; For example: Region_Welcome_Area = "DefaultRegion, FallbackRegion" + ; === HG ONLY === + ;; change this to the address of your simulator + Gatekeeper="http://127.0.0.1:9000" + + [LibraryModule] ; Set this if you want to change the name of the OpenSim Library ;LibraryName = "My World's Library"