*Removed ParcelManager from SceneObject and Primitive and replaced with events in EventManager

*Prim count and sim-wide prim count correctly reflect object bonus multiplier
afrisby
mingchen 2007-07-14 17:01:15 +00:00
parent eee1eb2f42
commit bf32020693
7 changed files with 50 additions and 22 deletions

View File

@ -683,7 +683,14 @@ namespace OpenSim.Region.Environment
updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; updatePacket.ParcelData.LandingType = (byte)parcelData.landingType;
updatePacket.ParcelData.LocalID = parcelData.localID; updatePacket.ParcelData.LocalID = parcelData.localID;
updatePacket.ParcelData.MaxPrims = 1000; //unemplemented if (parcelData.area > 0)
{
updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
}
else
{
updatePacket.ParcelData.MaxPrims = 0;
}
updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale;
updatePacket.ParcelData.MediaID = parcelData.mediaID; updatePacket.ParcelData.MediaID = parcelData.mediaID;
updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL);
@ -711,7 +718,7 @@ namespace OpenSim.Region.Environment
updatePacket.ParcelData.SequenceID = sequence_id; updatePacket.ParcelData.SequenceID = sequence_id;
if (parcelData.simwideArea > 0) if (parcelData.simwideArea > 0)
{ {
updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Floor((Convert.ToDecimal(65536) / Convert.ToDecimal(parcelData.simwideArea)) * 15000)); updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
} }
else else
{ {

View File

@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool m_isRootPrim; public bool m_isRootPrim;
public EntityBase m_Parent; public EntityBase m_Parent;
private ParcelManager m_parcelManager; private EventManager m_eventManager;
#region Properties #region Properties
/// <summary> /// <summary>
@ -132,12 +132,12 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="isRoot"></param> /// <param name="isRoot"></param>
/// <param name="parent"></param> /// <param name="parent"></param>
/// <param name="rootObject"></param> /// <param name="rootObject"></param>
public Primitive(ulong regionHandle, Scene world, ParcelManager parcelManager, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) public Primitive(ulong regionHandle, Scene world, EventManager eventManager, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
{ {
m_regionHandle = regionHandle; m_regionHandle = regionHandle;
m_world = world; m_world = world;
m_parcelManager = parcelManager; m_eventManager = eventManager;
inventoryItems = new Dictionary<LLUUID, InventoryItem>(); inventoryItems = new Dictionary<LLUUID, InventoryItem>();
this.m_Parent = parent; this.m_Parent = parent;
this.m_isRootPrim = isRoot; this.m_isRootPrim = isRoot;
@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes
this.Rotation = Axiom.Math.Quaternion.Identity; this.Rotation = Axiom.Math.Quaternion.Identity;
m_parcelManager.setPrimsTainted(); m_eventManager.TriggerParcelPrimCountTainted();
} }
/// <summary> /// <summary>
@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <remarks>Empty constructor for duplication</remarks> /// <remarks>Empty constructor for duplication</remarks>
public Primitive() public Primitive()
{ {
m_parcelManager.setPrimsTainted(); m_eventManager.TriggerParcelPrimCountTainted();
} }
#endregion #endregion
@ -165,7 +165,7 @@ namespace OpenSim.Region.Environment.Scenes
~Primitive() ~Primitive()
{ {
m_parcelManager.setPrimsTainted(); m_eventManager.TriggerParcelPrimCountTainted();
} }
#endregion #endregion
@ -276,7 +276,7 @@ namespace OpenSim.Region.Environment.Scenes
this.m_world.DeleteEntity(linkObject.rootUUID); this.m_world.DeleteEntity(linkObject.rootUUID);
linkObject.DeleteAllChildren(); linkObject.DeleteAllChildren();
m_parcelManager.setPrimsTainted(); m_eventManager.TriggerParcelPrimCountTainted();
} }
/// <summary> /// <summary>
@ -352,7 +352,7 @@ namespace OpenSim.Region.Environment.Scenes
prim.m_pos += offset; prim.m_pos += offset;
prim.updateFlag = 2; prim.updateFlag = 2;
} }
m_parcelManager.setPrimsTainted(); m_eventManager.TriggerParcelPrimCountTainted();
} }
/// <summary> /// <summary>
@ -404,7 +404,7 @@ namespace OpenSim.Region.Environment.Scenes
this.Pos = newPos; this.Pos = newPos;
this.updateFlag = 2; this.updateFlag = 2;
m_parcelManager.setPrimsTainted(); m_eventManager.TriggerParcelPrimCountTainted();
} }
/// <summary> /// <summary>
@ -440,7 +440,7 @@ namespace OpenSim.Region.Environment.Scenes
this.updateFlag = 2; this.updateFlag = 2;
} }
m_parcelManager.setPrimsTainted();
} }
#endregion #endregion

View File

@ -136,6 +136,9 @@ namespace OpenSim.Region.Environment.Scenes
m_scriptManager = new ScriptManager(this); m_scriptManager = new ScriptManager(this);
m_eventManager = new EventManager(); m_eventManager = new EventManager();
m_eventManager.OnParcelPrimCountTainted += new EventManager.OnParcelPrimCountTaintedDelegate(m_parcelManager.setPrimsTainted);
m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_parcelManager.addPrimToParcelCounts);
MainLog.Instance.Verbose("World.cs - creating new entitities instance"); MainLog.Instance.Verbose("World.cs - creating new entitities instance");
Entities = new Dictionary<LLUUID, EntityBase>(); Entities = new Dictionary<LLUUID, EntityBase>();
Avatars = new Dictionary<LLUUID, ScenePresence>(); Avatars = new Dictionary<LLUUID, ScenePresence>();
@ -453,7 +456,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="ownerID"></param> /// <param name="ownerID"></param>
public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
{ {
SceneObject sceneOb = new SceneObject(this, ownerID, this.PrimIDAllocate(), pos, shape); SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape);
AddNewEntity(sceneOb); AddNewEntity(sceneOb);
} }

View File

@ -19,9 +19,15 @@ namespace OpenSim.Region.Environment.Scenes
public delegate void OnRemovePresenceDelegate(LLUUID uuid); public delegate void OnRemovePresenceDelegate(LLUUID uuid);
public event OnRemovePresenceDelegate OnRemovePresence; public event OnRemovePresenceDelegate OnRemovePresence;
public delegate void OnParcelPrimCountTaintedDelegate();
public event OnParcelPrimCountTaintedDelegate OnParcelPrimCountTainted;
public delegate void OnParcelPrimCountUpdateDelegate(); public delegate void OnParcelPrimCountUpdateDelegate();
public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
public delegate void OnParcelPrimCountAddDelegate(SceneObject obj);
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
public void TriggerOnFrame() public void TriggerOnFrame()
{ {
if (OnFrame != null) if (OnFrame != null)
@ -52,6 +58,13 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void TriggerParcelPrimCountTainted()
{
if (OnParcelPrimCountTainted != null)
{
OnParcelPrimCountTainted();
}
}
public void TriggerParcelPrimCountUpdate() public void TriggerParcelPrimCountUpdate()
{ {
if (OnParcelPrimCountUpdate != null) if (OnParcelPrimCountUpdate != null)
@ -59,5 +72,12 @@ namespace OpenSim.Region.Environment.Scenes
OnParcelPrimCountUpdate(); OnParcelPrimCountUpdate();
} }
} }
public void TriggerParcelPrimCountAdd(SceneObject obj)
{
if (OnParcelPrimCountAdd != null)
{
OnParcelPrimCountAdd(obj);
}
}
} }
} }

View File

@ -48,7 +48,6 @@ namespace OpenSim.Region.Environment.Scenes
private PhysicsActor m_PhysActor; private PhysicsActor m_PhysActor;
private EventManager m_eventManager; private EventManager m_eventManager;
private ParcelManager m_parcelManager;
public LLUUID rootUUID public LLUUID rootUUID
{ {
@ -79,12 +78,11 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public SceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) public SceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{ {
m_regionHandle = world.RegionInfo.RegionHandle; m_regionHandle = world.RegionInfo.RegionHandle;
m_world = world; m_world = world;
m_eventManager = world.EventManager; m_eventManager = eventManager;
m_parcelManager = world.ParcelManager;
this.Pos = pos; this.Pos = pos;
this.CreateRootFromShape(ownerID, localID, shape, pos); this.CreateRootFromShape(ownerID, localID, shape, pos);
@ -127,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
private void ProcessParcelPrimCountUpdate() private void ProcessParcelPrimCountUpdate()
{ {
m_parcelManager.addPrimToParcelCounts(this); m_eventManager.TriggerParcelPrimCountAdd(this);
} }
@ -141,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param> /// <param name="localID"></param>
public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
{ {
this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world,this.m_parcelManager, agentID, localID, true, this, this, shape, pos); this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world,this.m_eventManager, agentID, localID, true, this, this, shape, pos);
this.children.Add(rootPrimitive); this.children.Add(rootPrimitive);
this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
} }

View File

@ -13,8 +13,8 @@ namespace SimpleApp
{ {
private PerformanceCounter m_counter; private PerformanceCounter m_counter;
public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) public MySceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
: base(world, ownerID, localID, pos, shape ) : base(world, eventManager, ownerID, localID, pos, shape )
{ {
String objectName = "Processor"; String objectName = "Processor";
String counterName = "% Processor Time"; String counterName = "% Processor Time";

View File

@ -75,7 +75,7 @@ namespace SimpleApp
shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
LLVector3 pos = new LLVector3(129, 129, 27); LLVector3 pos = new LLVector3(129, 129, 27);
m_sceneObject = new MySceneObject(world, LLUUID.Zero, world.PrimIDAllocate(), pos, shape); m_sceneObject = new MySceneObject(world,world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape);
world.AddNewEntity(m_sceneObject); world.AddNewEntity(m_sceneObject);
m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit.");