aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2009-06-25 12:26:23 +0000
committerMW2009-06-25 12:26:23 +0000
commit684286f097da943da8684db9b87b522a1c57754c (patch)
treeae9fff8e65d3ad51cc848fd4ebd826a1e7c4bd0d
parentmoving the m_PendingAcksMap.Remove() out of the foreach and clearing (diff)
downloadopensim-SC-684286f097da943da8684db9b87b522a1c57754c.zip
opensim-SC-684286f097da943da8684db9b87b522a1c57754c.tar.gz
opensim-SC-684286f097da943da8684db9b87b522a1c57754c.tar.bz2
opensim-SC-684286f097da943da8684db9b87b522a1c57754c.tar.xz
Applied patch from mantis #3820 which changed the clearing of the ScenePresence.m_forcesList, so it used the List.Clear method rather than doing a loop through the list and manually removing each item. Thanks dslake.
I also fixed the issue where the code also loops through the m_forcesList and copies each force to the ScenePresence's movementVector. Which resulted in only the last force in the list actually be acted on. As each copy overrode the last one. So now it only copies the last force in the list.
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs36
1 files changed, 16 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f4776e3..cc25f48 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3241,30 +3241,26 @@ namespace OpenSim.Region.Framework.Scenes
3241 { 3241 {
3242 if (m_forcesList.Count > 0) 3242 if (m_forcesList.Count > 0)
3243 { 3243 {
3244 for (int i = 0; i < m_forcesList.Count; i++) 3244 //we are only interested in the last force added to the list
3245 { 3245 NewForce force = m_forcesList[m_forcesList.Count - 1];
3246 NewForce force = m_forcesList[i];
3247 3246
3248 m_updateflag = true; 3247 m_updateflag = true;
3249 try 3248 try
3250 { 3249 {
3251 movementvector.X = force.X; 3250 movementvector.X = force.X;
3252 movementvector.Y = force.Y; 3251 movementvector.Y = force.Y;
3253 movementvector.Z = force.Z; 3252 movementvector.Z = force.Z;
3254 Velocity = movementvector; 3253 Velocity = movementvector;
3255 }
3256 catch (NullReferenceException)
3257 {
3258 // Under extreme load, this returns a NullReference Exception that we can ignore.
3259 // Ignoring this causes no movement to be sent to the physics engine...
3260 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
3261 }
3262 m_newForce = true;
3263 } 3254 }
3264 for (int i = 0; i < m_forcesList.Count; i++) 3255 catch (NullReferenceException)
3265 { 3256 {
3266 m_forcesList.RemoveAt(0); 3257 // Under extreme load, this returns a NullReference Exception that we can ignore.
3258 // Ignoring this causes no movement to be sent to the physics engine...
3259 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
3267 } 3260 }
3261 m_newForce = true;
3262
3263 m_forcesList.Clear();
3268 } 3264 }
3269 } 3265 }
3270 } 3266 }