Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2011-04-01 07:44:43 +01:00
commit 329fa73695
25 changed files with 404 additions and 83 deletions

View File

@ -1267,7 +1267,7 @@ namespace OpenSim.Client.MXP.ClientStack
// Need to translate to MXP somehow // 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 // Need to translate to MXP somehow
} }

View File

@ -805,7 +805,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException(); 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(); throw new System.NotImplementedException();
} }

View File

@ -1148,7 +1148,17 @@ namespace OpenSim.Framework
void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags,
uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner); uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner);
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, /// <summary>
/// Send land properties to the client.
/// </summary>
/// <param name="sequence_id"></param>
/// <param name="snap_selection"></param>
/// <param name="request_result"></param>
/// <param name="lo"></param></param>
/// <param name="parcelObjectCapacity">/param>
/// <param name="simObjectCapacity"></param>
/// <param name="regionFlags"></param>
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo,
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity,
uint regionFlags); uint regionFlags);

View File

@ -27,10 +27,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenMetaverse; 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 overrideParcelMaxPrimCountDelegate(ILandObject obj);
public delegate int overrideSimulatorMaxPrimCountDelegate(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); bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add);
void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client); void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client);
void SendLandObjectOwners(IClientAPI remote_client); void SendLandObjectOwners(IClientAPI remote_client);
void ReturnObject(SceneObjectGroup obj);
void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client);
void ResetLandPrimCounts(); 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 UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area);
void DeedToGroup(UUID groupID); void DeedToGroup(UUID groupID);

View File

@ -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
{
/// <summary>
/// Parcel owner owned prims
/// </summary>
int Owner { get; }
/// <summary>
/// Parcel group owned prims
/// </summary>
int Group { get; }
/// <summary>
/// Prims owned by others (not parcel owner or parcel group).
/// </summary>
int Others { get; }
/// <summary>
/// Selected prims
/// </summary>
int Selected { get; }
/// <summary>
/// Total prims on the parcel.
/// </summary>
int Total { get; }
/// <summary>
/// Prims on the simulator that are owned by the parcel owner, even if they are in other parcels.
/// </summary>
int Simulator { get; }
/// <summary>
/// Prims per individual users.
/// </summary>
IUserPrimCounts Users { get; }
}
public interface IUserPrimCounts
{
int this[UUID agentID] { get; }
}
}

View File

@ -4337,8 +4337,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(packet, ThrottleOutPacketType.Task); 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(); ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
updateMessage.AABBMax = landData.AABBMax; updateMessage.AABBMax = landData.AABBMax;
@ -4346,15 +4352,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.Area = landData.Area; updateMessage.Area = landData.Area;
updateMessage.AuctionID = landData.AuctionID; updateMessage.AuctionID = landData.AuctionID;
updateMessage.AuthBuyerID = landData.AuthBuyerID; updateMessage.AuthBuyerID = landData.AuthBuyerID;
updateMessage.Bitmap = landData.Bitmap; updateMessage.Bitmap = landData.Bitmap;
updateMessage.Desc = landData.Description; updateMessage.Desc = landData.Description;
updateMessage.Category = landData.Category; updateMessage.Category = landData.Category;
updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate);
updateMessage.ClaimPrice = landData.ClaimPrice; updateMessage.ClaimPrice = landData.ClaimPrice;
updateMessage.GroupID = landData.GroupID; updateMessage.GroupID = landData.GroupID;
updateMessage.GroupPrims = landData.GroupPrims;
updateMessage.IsGroupOwned = landData.IsGroupOwned; updateMessage.IsGroupOwned = landData.IsGroupOwned;
updateMessage.LandingType = (LandingType) landData.LandingType; updateMessage.LandingType = (LandingType) landData.LandingType;
updateMessage.LocalID = landData.LocalID; updateMessage.LocalID = landData.LocalID;
@ -4375,9 +4378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.Name = landData.Name; updateMessage.Name = landData.Name;
updateMessage.OtherCleanTime = landData.OtherCleanTime; updateMessage.OtherCleanTime = landData.OtherCleanTime;
updateMessage.OtherCount = 0; //TODO: Unimplemented updateMessage.OtherCount = 0; //TODO: Unimplemented
updateMessage.OtherPrims = landData.OtherPrims;
updateMessage.OwnerID = landData.OwnerID; updateMessage.OwnerID = landData.OwnerID;
updateMessage.OwnerPrims = landData.OwnerPrims;
updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; updateMessage.ParcelFlags = (ParcelFlags) landData.Flags;
updateMessage.ParcelPrimBonus = simObjectBonusFactor; updateMessage.ParcelPrimBonus = simObjectBonusFactor;
updateMessage.PassHours = landData.PassHours; updateMessage.PassHours = landData.PassHours;
@ -4393,9 +4394,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.RentPrice = 0; updateMessage.RentPrice = 0;
updateMessage.RequestResult = (ParcelResult) request_result; updateMessage.RequestResult = (ParcelResult) request_result;
updateMessage.SalePrice = landData.SalePrice; updateMessage.SalePrice = landData.SalePrice;
updateMessage.SelectedPrims = landData.SelectedPrims;
updateMessage.SelfCount = 0; //TODO: Unimplemented updateMessage.SelfCount = 0; //TODO: Unimplemented
updateMessage.SequenceID = sequence_id; updateMessage.SequenceID = sequence_id;
if (landData.SimwideArea > 0) if (landData.SimwideArea > 0)
{ {
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
@ -4405,12 +4406,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
updateMessage.SimWideMaxPrims = 0; updateMessage.SimWideMaxPrims = 0;
} }
updateMessage.SimWideTotalPrims = landData.SimwidePrims;
updateMessage.SnapSelection = snap_selection; updateMessage.SnapSelection = snap_selection;
updateMessage.SnapshotID = landData.SnapshotID; updateMessage.SnapshotID = landData.SnapshotID;
updateMessage.Status = (ParcelStatus) landData.Status; updateMessage.Status = (ParcelStatus) landData.Status;
updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims +
landData.SelectedPrims;
updateMessage.UserLocation = landData.UserLocation; updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt; updateMessage.UserLookAt = landData.UserLookAt;
@ -4422,19 +4421,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.ObscureMusic = landData.ObscureMusic; updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia; 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 try
{ {
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null) if (eq != null)
{ {
eq.ParcelProperties(updateMessage, this.AgentId); 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) 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());
} }
} }

View File

@ -28,6 +28,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Nini.Config; using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenMetaverse; using OpenMetaverse;

View File

@ -722,7 +722,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ILandObject landUnderPrim = GetLandObject(position.X, position.Y); ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
if (landUnderPrim != null) if (landUnderPrim != null)
{ {
landUnderPrim.AddPrimToCount(obj); ((LandObject)landUnderPrim).AddPrimToCount(obj);
} }
} }

View File

@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
remote_client.SendLandProperties(seq_id, remote_client.SendLandProperties(seq_id,
snap_selection, request_result, LandData, snap_selection, request_result, this,
(float)m_scene.RegionInfo.RegionSettings.ObjectBonus, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
GetParcelMaxPrimCount(this), GetParcelMaxPrimCount(this),
GetSimulatorMaxPrimCount(this), regionFlags); GetSimulatorMaxPrimCount(this), regionFlags);

View File

@ -45,14 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land
public int Owner = 0; public int Owner = 0;
public int Group = 0; public int Group = 0;
public int Others = 0; public int Others = 0;
public Dictionary <UUID, int> Users = public int Selected = 0;
new Dictionary <UUID, int>(); public Dictionary <UUID, int> Users = new Dictionary <UUID, int>();
} }
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
{ {
// private static readonly ILog m_log = private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_Scene; private Scene m_Scene;
private Dictionary<UUID, PrimCounts> m_PrimCounts = private Dictionary<UUID, PrimCounts> m_PrimCounts =
@ -64,7 +63,6 @@ namespace OpenSim.Region.CoreModules.World.Land
private Dictionary<UUID, ParcelCounts> m_ParcelCounts = private Dictionary<UUID, ParcelCounts> m_ParcelCounts =
new Dictionary<UUID, ParcelCounts>(); new Dictionary<UUID, ParcelCounts>();
/// <value> /// <value>
/// For now, a simple simwide taint to get this up. Later parcel based /// For now, a simple simwide taint to get this up. Later parcel based
/// taint to allow recounting a parcel if only ownership has changed /// taint to allow recounting a parcel if only ownership has changed
@ -96,6 +94,7 @@ namespace OpenSim.Region.CoreModules.World.Land
OnObjectBeingRemovedFromScene; OnObjectBeingRemovedFromScene;
m_Scene.EventManager.OnParcelPrimCountTainted += m_Scene.EventManager.OnParcelPrimCountTainted +=
OnParcelPrimCountTainted; OnParcelPrimCountTainted;
m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
@ -123,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
if (!m_Tainted) if (!m_Tainted)
AddObject(obj); 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) if (!m_Tainted)
RemoveObject(obj); 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() private void OnParcelPrimCountTainted()
{ {
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName);
lock (m_TaintLock) lock (m_TaintLock)
m_Tainted = true; m_Tainted = true;
} }
@ -163,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// NOTE: Call under Taint Lock // NOTE: Call under Taint Lock
private void AddObject(SceneObjectGroup obj) 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) if (obj.IsAttachment)
return; return;
@ -208,16 +219,25 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
parcelCounts.Others += partCount; parcelCounts.Others += partCount;
} }
if (obj.IsSelected)
parcelCounts.Selected += partCount;
} }
} }
// NOTE: Call under Taint Lock // NOTE: Call under Taint Lock
private void RemoveObject(SceneObjectGroup obj) 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) public IPrimCounts GetPrimCounts(UUID parcelID)
{ {
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName);
PrimCounts primCounts; PrimCounts primCounts;
lock (m_PrimCounts) lock (m_PrimCounts)
@ -239,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <returns></returns> /// <returns></returns>
public int GetOwnerCount(UUID parcelID) public int GetOwnerCount(UUID parcelID)
{ {
// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); int count = 0;
lock (m_TaintLock) lock (m_TaintLock)
{ {
@ -248,9 +268,14 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelCounts counts; ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out 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;
} }
/// <summary> /// <summary>
@ -260,6 +285,8 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <returns></returns> /// <returns></returns>
public int GetGroupCount(UUID parcelID) public int GetGroupCount(UUID parcelID)
{ {
int count = 0;
lock (m_TaintLock) lock (m_TaintLock)
{ {
if (m_Tainted) if (m_Tainted)
@ -267,9 +294,14 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelCounts counts; ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out 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;
} }
/// <summary> /// <summary>
@ -279,6 +311,8 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <returns></returns> /// <returns></returns>
public int GetOthersCount(UUID parcelID) public int GetOthersCount(UUID parcelID)
{ {
int count = 0;
lock (m_TaintLock) lock (m_TaintLock)
{ {
if (m_Tainted) if (m_Tainted)
@ -286,9 +320,71 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelCounts counts; ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out 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;
}
/// <summary>
/// Get the number of selected prims.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Get the total count of owner, group and others prims on the parcel.
/// FIXME: Need to do selected prims once this is reimplemented.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
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;
} }
/// <summary> /// <summary>
@ -298,6 +394,8 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <returns></returns> /// <returns></returns>
public int GetSimulatorCount(UUID parcelID) public int GetSimulatorCount(UUID parcelID)
{ {
int count = 0;
lock (m_TaintLock) lock (m_TaintLock)
{ {
if (m_Tainted) if (m_Tainted)
@ -308,10 +406,15 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
int val; int val;
if (m_SimwideCounts.TryGetValue(owner, out 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;
} }
/// <summary> /// <summary>
@ -322,6 +425,8 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <returns></returns> /// <returns></returns>
public int GetUserCount(UUID parcelID, UUID userID) public int GetUserCount(UUID parcelID, UUID userID)
{ {
int count = 0;
lock (m_TaintLock) lock (m_TaintLock)
{ {
if (m_Tainted) if (m_Tainted)
@ -332,10 +437,15 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
int val; int val;
if (counts.Users.TryGetValue(userID, out 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! // 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)) if (!m_OwnerMap.ContainsKey(k))
m_PrimCounts.Remove(k); m_PrimCounts.Remove(k);
} }
m_Tainted = false; m_Tainted = false;
} }
} }
@ -409,6 +520,22 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
public int Selected
{
get
{
return m_Parent.GetSelectedCount(m_ParcelID);
}
}
public int Total
{
get
{
return m_Parent.GetTotalCount(m_ParcelID);
}
}
public int Simulator public int Simulator
{ {
get get

View File

@ -78,6 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(0)); Assert.That(pc.Owner, Is.EqualTo(0));
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, 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_userId], Is.EqualTo(0));
Assert.That(pc.Users[m_dummyUserId], 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));
@ -88,6 +90,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(3)); Assert.That(pc.Owner, Is.EqualTo(3));
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, 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_userId], Is.EqualTo(3));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3)); 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.Owner, Is.EqualTo(5));
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, 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_userId], Is.EqualTo(5));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(5)); Assert.That(pc.Simulator, Is.EqualTo(5));
} }
/// <summary>
/// Test count after a parcel owner owned copied object is added.
/// </summary>
[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));
}
/// <summary> /// <summary>
/// Test count after a parcel owner owned object is removed. /// Test count after a parcel owner owned object is removed.
/// </summary> /// </summary>
@ -123,9 +154,35 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pc.Owner, Is.EqualTo(1)); Assert.That(pc.Owner, Is.EqualTo(1));
Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, 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_userId], Is.EqualTo(1));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(1)); Assert.That(pc.Simulator, Is.EqualTo(1));
} }
/// <summary>
/// Test the count is correct after is has been tainted.
/// </summary>
[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));
}
} }
} }

View File

@ -62,9 +62,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
return LoadBitmap(new Bitmap(filename)); 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) public virtual ITerrainChannel LoadStream(Stream stream)

View File

@ -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 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
regionInfos = new List<GridRegion>(); regionInfos = new List<GridRegion>();
GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); 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<MapBlockData> blocks = new List<MapBlockData>(); List<MapBlockData> blocks = new List<MapBlockData>();
MapBlockData data; MapBlockData data;

View File

@ -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)
{ {
} }

View File

@ -38,18 +38,4 @@ namespace OpenSim.Region.Framework.Interfaces
IPrimCounts GetPrimCounts(UUID parcelID); 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; }
}
} }

View File

@ -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)
{ {
} }

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -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<UUID> avatars, uint accessFlag, int localLandID) public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)

View File

@ -65,6 +65,8 @@ namespace OpenSim.Services.GridService
protected UUID m_ScopeID = UUID.Zero; protected UUID m_ScopeID = UUID.Zero;
protected bool m_Check4096 = true; protected bool m_Check4096 = true;
protected string m_MapTileDirectory = string.Empty; protected string m_MapTileDirectory = string.Empty;
protected string m_ThisGatekeeper = string.Empty;
protected Uri m_ThisGatekeeperURI = null;
// Hyperlink regions are hyperlinks on the map // Hyperlink regions are hyperlinks on the map
public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
@ -123,6 +125,16 @@ namespace OpenSim.Services.GridService
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); 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_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
@ -210,6 +222,8 @@ namespace OpenSim.Services.GridService
remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
reason = string.Empty; reason = string.Empty;
Uri uri = null;
regInfo = new GridRegion(); regInfo = new GridRegion();
if ( externalPort > 0) if ( externalPort > 0)
regInfo.HttpPort = externalPort; regInfo.HttpPort = externalPort;
@ -220,7 +234,16 @@ namespace OpenSim.Services.GridService
else else
regInfo.ExternalHostName = "0.0.0.0"; regInfo.ExternalHostName = "0.0.0.0";
if ( serverURI != null) if ( serverURI != null)
{
regInfo.ServerURI = serverURI; regInfo.ServerURI = serverURI;
try
{
uri = new Uri(serverURI);
regInfo.ExternalHostName = uri.Host;
regInfo.HttpPort = (uint)uri.Port;
}
catch {}
}
if ( remoteRegionName != string.Empty ) if ( remoteRegionName != string.Empty )
regInfo.RegionName = remoteRegionName; regInfo.RegionName = remoteRegionName;
@ -230,6 +253,18 @@ namespace OpenSim.Services.GridService
regInfo.ScopeID = scopeID; regInfo.ScopeID = scopeID;
regInfo.EstateOwner = ownerID; 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 // Check for free coordinates
GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
if (region != null) if (region != null)

View File

@ -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)
{ {
} }

View File

@ -44,7 +44,7 @@ for more information.
To run OpenSim, from the unpacked distribution type: To run OpenSim, from the unpacked distribution type:
* cd bin * cd bin
* LD_LIBRARY_PATH=. mono OpenSim.exe * mono OpenSim.exe
Now see the "Configuring OpenSim" section Now see the "Configuring OpenSim" section

View File

@ -1,4 +1,4 @@
<configuration> <configuration>
<dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="libsqlite3_64.so" /> <dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="./libsqlite3_64.so" />
<dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="libsqlite3_32.so" /> <dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="./libsqlite3_32.so" />
</configuration> </configuration>

View File

@ -45,6 +45,12 @@
;; Directory for map tile images of linked regions ;; Directory for map tile images of linked regions
; MapTileDirectory = "./maptiles" ; 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] [AvatarService]
; ;
; change this to your grid-wide grid server ; change this to your grid-wide grid server

View File

@ -78,6 +78,11 @@
;; For example: ;; For example:
Region_Welcome_Area = "DefaultRegion, FallbackRegion" Region_Welcome_Area = "DefaultRegion, FallbackRegion"
; === HG ONLY ===
;; change this to the address of your simulator
Gatekeeper="http://127.0.0.1:9000"
[LibraryModule] [LibraryModule]
; Set this if you want to change the name of the OpenSim Library ; Set this if you want to change the name of the OpenSim Library
;LibraryName = "My World's Library" ;LibraryName = "My World's Library"