aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorThomas Grimshaw2010-04-05 23:17:06 +0200
committerThomas Grimshaw2010-04-05 23:17:06 +0200
commit2f454843d82ce0253af393817cf6f0ebb9046112 (patch)
tree06b005f3cd9ab6ce2d9cbf02591ae17c8cd62c5c /OpenSim/Region/Framework
parentMerge branch 'master' of ssh://TOR/var/git/careminster (diff)
downloadopensim-SC_OLD-2f454843d82ce0253af393817cf6f0ebb9046112.zip
opensim-SC_OLD-2f454843d82ce0253af393817cf6f0ebb9046112.tar.gz
opensim-SC_OLD-2f454843d82ce0253af393817cf6f0ebb9046112.tar.bz2
opensim-SC_OLD-2f454843d82ce0253af393817cf6f0ebb9046112.tar.xz
Fix up my own shoddy code! Fixes prim rez break. Whups!
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs48
1 files changed, 26 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0277ed8..13d1d4e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -106,9 +106,9 @@ namespace OpenSim.Region.Framework.Scenes
106 private bool m_hasGroupChanged = false; 106 private bool m_hasGroupChanged = false;
107 private long timeFirstChanged = 0; 107 private long timeFirstChanged = 0;
108 private long timeLastChanged = 0; 108 private long timeLastChanged = 0;
109 long m_maxPersistTime = 0; 109 private long m_maxPersistTime = 0;
110 long m_minPersistTime = 0; 110 private long m_minPersistTime = 0;
111 Random m_rand; 111 private Random m_rand;
112 112
113 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim(); 113 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim();
114 114
@@ -186,27 +186,31 @@ namespace OpenSim.Region.Framework.Scenes
186 timeLastChanged = DateTime.Now.Ticks; 186 timeLastChanged = DateTime.Now.Ticks;
187 if (!m_hasGroupChanged) 187 if (!m_hasGroupChanged)
188 timeFirstChanged = DateTime.Now.Ticks; 188 timeFirstChanged = DateTime.Now.Ticks;
189 if (m_rand == null) 189 if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null)
190 { 190 {
191 byte[] val = new byte[16]; 191 if (m_rand == null)
192 m_rootPart.UUID.ToBytes(val, 0); 192 {
193 m_rand = new Random(BitConverter.ToInt32(val, 0)); 193 byte[] val = new byte[16];
194 } 194 m_rootPart.UUID.ToBytes(val, 0);
195 if (Scene.GetRootAgentCount() == 0) 195 m_rand = new Random(BitConverter.ToInt32(val, 0));
196 { 196 }
197 //If the region is empty, this change has been made by an automated process 197
198 //and thus we delay the persist time by a random amount between 1.5 and 2.5. 198 if (m_scene.GetRootAgentCount() == 0)
199 {
200 //If the region is empty, this change has been made by an automated process
201 //and thus we delay the persist time by a random amount between 1.5 and 2.5.
199 202
200 float factor = 1.5f + (float)(m_rand.NextDouble()); 203 float factor = 1.5f + (float)(m_rand.NextDouble());
201 m_maxPersistTime = (long)((float)Scene.m_persistAfter * factor); 204 m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor);
202 m_minPersistTime = (long)((float)Scene.m_dontPersistBefore * factor); 205 m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor);
203 } 206 }
204 else 207 else
205 { 208 {
206 //If the region is not empty, we want to obey the minimum and maximum persist times 209 //If the region is not empty, we want to obey the minimum and maximum persist times
207 //but add a random factor so we stagger the object persistance a little 210 //but add a random factor so we stagger the object persistance a little
208 m_maxPersistTime = (long)((float)Scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 211 m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5
209 m_minPersistTime = (long)((float)Scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 212 m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0
213 }
210 } 214 }
211 } 215 }
212 m_hasGroupChanged = value; 216 m_hasGroupChanged = value;