Merge branch 'master' of ssh://3dhosting.de/var/git/careminster

avinationmerge
Melanie Thielker 2010-04-05 23:22:14 +02:00
commit e40acda6c8
1 changed files with 26 additions and 22 deletions

View File

@ -106,9 +106,9 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_hasGroupChanged = false; private bool m_hasGroupChanged = false;
private long timeFirstChanged = 0; private long timeFirstChanged = 0;
private long timeLastChanged = 0; private long timeLastChanged = 0;
long m_maxPersistTime = 0; private long m_maxPersistTime = 0;
long m_minPersistTime = 0; private long m_minPersistTime = 0;
Random m_rand; private Random m_rand;
private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim(); private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim();
@ -186,27 +186,31 @@ namespace OpenSim.Region.Framework.Scenes
timeLastChanged = DateTime.Now.Ticks; timeLastChanged = DateTime.Now.Ticks;
if (!m_hasGroupChanged) if (!m_hasGroupChanged)
timeFirstChanged = DateTime.Now.Ticks; timeFirstChanged = DateTime.Now.Ticks;
if (m_rand == null) if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null)
{ {
byte[] val = new byte[16]; if (m_rand == null)
m_rootPart.UUID.ToBytes(val, 0); {
m_rand = new Random(BitConverter.ToInt32(val, 0)); byte[] val = new byte[16];
} m_rootPart.UUID.ToBytes(val, 0);
if (Scene.GetRootAgentCount() == 0) m_rand = new Random(BitConverter.ToInt32(val, 0));
{ }
//If the region is empty, this change has been made by an automated process
//and thus we delay the persist time by a random amount between 1.5 and 2.5.
float factor = 1.5f + (float)(m_rand.NextDouble()); if (m_scene.GetRootAgentCount() == 0)
m_maxPersistTime = (long)((float)Scene.m_persistAfter * factor); {
m_minPersistTime = (long)((float)Scene.m_dontPersistBefore * factor); //If the region is empty, this change has been made by an automated process
} //and thus we delay the persist time by a random amount between 1.5 and 2.5.
else
{ float factor = 1.5f + (float)(m_rand.NextDouble());
//If the region is not empty, we want to obey the minimum and maximum persist times m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor);
//but add a random factor so we stagger the object persistance a little m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor);
m_maxPersistTime = (long)((float)Scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 }
m_minPersistTime = (long)((float)Scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 else
{
//If the region is not empty, we want to obey the minimum and maximum persist times
//but add a random factor so we stagger the object persistance a little
m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5
m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0
}
} }
} }
m_hasGroupChanged = value; m_hasGroupChanged = value;