aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authormingchen2007-07-14 17:01:15 +0000
committermingchen2007-07-14 17:01:15 +0000
commitbf32020693b62685bc15f2e56cd2b717f4e170a7 (patch)
tree80256e8f0217533ecfd4aa6fa7f44e7c3ac49ed5 /OpenSim/Region/Environment
parent* SimpleApp finally doing something fun. :) (diff)
downloadopensim-SC-bf32020693b62685bc15f2e56cd2b717f4e170a7.zip
opensim-SC-bf32020693b62685bc15f2e56cd2b717f4e170a7.tar.gz
opensim-SC-bf32020693b62685bc15f2e56cd2b717f4e170a7.tar.bz2
opensim-SC-bf32020693b62685bc15f2e56cd2b717f4e170a7.tar.xz
*Removed ParcelManager from SceneObject and Primitive and replaced with events in EventManager
*Prim count and sim-wide prim count correctly reflect object bonus multiplier
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/ParcelManager.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs10
5 files changed, 47 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs
index 28bfd4c..3603caa 100644
--- a/OpenSim/Region/Environment/ParcelManager.cs
+++ b/OpenSim/Region/Environment/ParcelManager.cs
@@ -683,7 +683,14 @@ namespace OpenSim.Region.Environment
683 updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; 683 updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
684 updatePacket.ParcelData.LandingType = (byte)parcelData.landingType; 684 updatePacket.ParcelData.LandingType = (byte)parcelData.landingType;
685 updatePacket.ParcelData.LocalID = parcelData.localID; 685 updatePacket.ParcelData.LocalID = parcelData.localID;
686 updatePacket.ParcelData.MaxPrims = 1000; //unemplemented 686 if (parcelData.area > 0)
687 {
688 updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
689 }
690 else
691 {
692 updatePacket.ParcelData.MaxPrims = 0;
693 }
687 updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale; 694 updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale;
688 updatePacket.ParcelData.MediaID = parcelData.mediaID; 695 updatePacket.ParcelData.MediaID = parcelData.mediaID;
689 updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL); 696 updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL);
@@ -711,7 +718,7 @@ namespace OpenSim.Region.Environment
711 updatePacket.ParcelData.SequenceID = sequence_id; 718 updatePacket.ParcelData.SequenceID = sequence_id;
712 if (parcelData.simwideArea > 0) 719 if (parcelData.simwideArea > 0)
713 { 720 {
714 updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Floor((Convert.ToDecimal(65536) / Convert.ToDecimal(parcelData.simwideArea)) * 15000)); 721 updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
715 } 722 }
716 else 723 else
717 { 724 {
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 79d5785..833bf85 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Scenes
45 public bool m_isRootPrim; 45 public bool m_isRootPrim;
46 public EntityBase m_Parent; 46 public EntityBase m_Parent;
47 47
48 private ParcelManager m_parcelManager; 48 private EventManager m_eventManager;
49 49
50 #region Properties 50 #region Properties
51 /// <summary> 51 /// <summary>
@@ -132,12 +132,12 @@ namespace OpenSim.Region.Environment.Scenes
132 /// <param name="isRoot"></param> 132 /// <param name="isRoot"></param>
133 /// <param name="parent"></param> 133 /// <param name="parent"></param>
134 /// <param name="rootObject"></param> 134 /// <param name="rootObject"></param>
135 public Primitive(ulong regionHandle, Scene world, ParcelManager parcelManager, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) 135 public Primitive(ulong regionHandle, Scene world, EventManager eventManager, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
136 { 136 {
137 137
138 m_regionHandle = regionHandle; 138 m_regionHandle = regionHandle;
139 m_world = world; 139 m_world = world;
140 m_parcelManager = parcelManager; 140 m_eventManager = eventManager;
141 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 141 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
142 this.m_Parent = parent; 142 this.m_Parent = parent;
143 this.m_isRootPrim = isRoot; 143 this.m_isRootPrim = isRoot;
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes
147 this.Rotation = Axiom.Math.Quaternion.Identity; 147 this.Rotation = Axiom.Math.Quaternion.Identity;
148 148
149 149
150 m_parcelManager.setPrimsTainted(); 150 m_eventManager.TriggerParcelPrimCountTainted();
151 } 151 }
152 152
153 /// <summary> 153 /// <summary>
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes
156 /// <remarks>Empty constructor for duplication</remarks> 156 /// <remarks>Empty constructor for duplication</remarks>
157 public Primitive() 157 public Primitive()
158 { 158 {
159 m_parcelManager.setPrimsTainted(); 159 m_eventManager.TriggerParcelPrimCountTainted();
160 } 160 }
161 161
162 #endregion 162 #endregion
@@ -165,7 +165,7 @@ namespace OpenSim.Region.Environment.Scenes
165 165
166 ~Primitive() 166 ~Primitive()
167 { 167 {
168 m_parcelManager.setPrimsTainted(); 168 m_eventManager.TriggerParcelPrimCountTainted();
169 } 169 }
170 #endregion 170 #endregion
171 171
@@ -276,7 +276,7 @@ namespace OpenSim.Region.Environment.Scenes
276 this.m_world.DeleteEntity(linkObject.rootUUID); 276 this.m_world.DeleteEntity(linkObject.rootUUID);
277 linkObject.DeleteAllChildren(); 277 linkObject.DeleteAllChildren();
278 278
279 m_parcelManager.setPrimsTainted(); 279 m_eventManager.TriggerParcelPrimCountTainted();
280 } 280 }
281 281
282 /// <summary> 282 /// <summary>
@@ -352,7 +352,7 @@ namespace OpenSim.Region.Environment.Scenes
352 prim.m_pos += offset; 352 prim.m_pos += offset;
353 prim.updateFlag = 2; 353 prim.updateFlag = 2;
354 } 354 }
355 m_parcelManager.setPrimsTainted(); 355 m_eventManager.TriggerParcelPrimCountTainted();
356 } 356 }
357 357
358 /// <summary> 358 /// <summary>
@@ -404,7 +404,7 @@ namespace OpenSim.Region.Environment.Scenes
404 this.Pos = newPos; 404 this.Pos = newPos;
405 this.updateFlag = 2; 405 this.updateFlag = 2;
406 406
407 m_parcelManager.setPrimsTainted(); 407 m_eventManager.TriggerParcelPrimCountTainted();
408 } 408 }
409 409
410 /// <summary> 410 /// <summary>
@@ -440,7 +440,7 @@ namespace OpenSim.Region.Environment.Scenes
440 this.updateFlag = 2; 440 this.updateFlag = 2;
441 } 441 }
442 442
443 m_parcelManager.setPrimsTainted(); 443
444 } 444 }
445 445
446 #endregion 446 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 9565c02..03e7a41 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -136,6 +136,9 @@ namespace OpenSim.Region.Environment.Scenes
136 m_scriptManager = new ScriptManager(this); 136 m_scriptManager = new ScriptManager(this);
137 m_eventManager = new EventManager(); 137 m_eventManager = new EventManager();
138 138
139 m_eventManager.OnParcelPrimCountTainted += new EventManager.OnParcelPrimCountTaintedDelegate(m_parcelManager.setPrimsTainted);
140 m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_parcelManager.addPrimToParcelCounts);
141
139 MainLog.Instance.Verbose("World.cs - creating new entitities instance"); 142 MainLog.Instance.Verbose("World.cs - creating new entitities instance");
140 Entities = new Dictionary<LLUUID, EntityBase>(); 143 Entities = new Dictionary<LLUUID, EntityBase>();
141 Avatars = new Dictionary<LLUUID, ScenePresence>(); 144 Avatars = new Dictionary<LLUUID, ScenePresence>();
@@ -453,7 +456,7 @@ namespace OpenSim.Region.Environment.Scenes
453 /// <param name="ownerID"></param> 456 /// <param name="ownerID"></param>
454 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) 457 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
455 { 458 {
456 SceneObject sceneOb = new SceneObject(this, ownerID, this.PrimIDAllocate(), pos, shape); 459 SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape);
457 AddNewEntity(sceneOb); 460 AddNewEntity(sceneOb);
458 } 461 }
459 462
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 685ed8c..46768d5 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -19,9 +19,15 @@ namespace OpenSim.Region.Environment.Scenes
19 public delegate void OnRemovePresenceDelegate(LLUUID uuid); 19 public delegate void OnRemovePresenceDelegate(LLUUID uuid);
20 public event OnRemovePresenceDelegate OnRemovePresence; 20 public event OnRemovePresenceDelegate OnRemovePresence;
21 21
22 public delegate void OnParcelPrimCountTaintedDelegate();
23 public event OnParcelPrimCountTaintedDelegate OnParcelPrimCountTainted;
24
22 public delegate void OnParcelPrimCountUpdateDelegate(); 25 public delegate void OnParcelPrimCountUpdateDelegate();
23 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; 26 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
24 27
28 public delegate void OnParcelPrimCountAddDelegate(SceneObject obj);
29 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
30
25 public void TriggerOnFrame() 31 public void TriggerOnFrame()
26 { 32 {
27 if (OnFrame != null) 33 if (OnFrame != null)
@@ -52,6 +58,13 @@ namespace OpenSim.Region.Environment.Scenes
52 } 58 }
53 } 59 }
54 60
61 public void TriggerParcelPrimCountTainted()
62 {
63 if (OnParcelPrimCountTainted != null)
64 {
65 OnParcelPrimCountTainted();
66 }
67 }
55 public void TriggerParcelPrimCountUpdate() 68 public void TriggerParcelPrimCountUpdate()
56 { 69 {
57 if (OnParcelPrimCountUpdate != null) 70 if (OnParcelPrimCountUpdate != null)
@@ -59,5 +72,12 @@ namespace OpenSim.Region.Environment.Scenes
59 OnParcelPrimCountUpdate(); 72 OnParcelPrimCountUpdate();
60 } 73 }
61 } 74 }
75 public void TriggerParcelPrimCountAdd(SceneObject obj)
76 {
77 if (OnParcelPrimCountAdd != null)
78 {
79 OnParcelPrimCountAdd(obj);
80 }
81 }
62 } 82 }
63} 83}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 7c49ddb..68d214b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -48,7 +48,6 @@ namespace OpenSim.Region.Environment.Scenes
48 private PhysicsActor m_PhysActor; 48 private PhysicsActor m_PhysActor;
49 49
50 private EventManager m_eventManager; 50 private EventManager m_eventManager;
51 private ParcelManager m_parcelManager;
52 51
53 public LLUUID rootUUID 52 public LLUUID rootUUID
54 { 53 {
@@ -79,12 +78,11 @@ namespace OpenSim.Region.Environment.Scenes
79 /// <summary> 78 /// <summary>
80 /// 79 ///
81 /// </summary> 80 /// </summary>
82 public SceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 81 public SceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
83 { 82 {
84 m_regionHandle = world.RegionInfo.RegionHandle; 83 m_regionHandle = world.RegionInfo.RegionHandle;
85 m_world = world; 84 m_world = world;
86 m_eventManager = world.EventManager; 85 m_eventManager = eventManager;
87 m_parcelManager = world.ParcelManager;
88 86
89 this.Pos = pos; 87 this.Pos = pos;
90 this.CreateRootFromShape(ownerID, localID, shape, pos); 88 this.CreateRootFromShape(ownerID, localID, shape, pos);
@@ -127,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes
127 /// </summary> 125 /// </summary>
128 private void ProcessParcelPrimCountUpdate() 126 private void ProcessParcelPrimCountUpdate()
129 { 127 {
130 m_parcelManager.addPrimToParcelCounts(this); 128 m_eventManager.TriggerParcelPrimCountAdd(this);
131 } 129 }
132 130
133 131
@@ -141,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
141 /// <param name="localID"></param> 139 /// <param name="localID"></param>
142 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) 140 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
143 { 141 {
144 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world,this.m_parcelManager, agentID, localID, true, this, this, shape, pos); 142 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world,this.m_eventManager, agentID, localID, true, this, this, shape, pos);
145 this.children.Add(rootPrimitive); 143 this.children.Add(rootPrimitive);
146 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); 144 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
147 } 145 }