aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
diff options
context:
space:
mode:
authorJeff Ames2007-11-20 05:09:30 +0000
committerJeff Ames2007-11-20 05:09:30 +0000
commit83ed435d01724b28771c4acaadf1f74e8114b12a (patch)
tree185b10520e9ae8fa8753af05f24268da84f391c4 /OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
parentfixed array range out of bounds exception and reference invalidation under lo... (diff)
downloadopensim-SC_OLD-83ed435d01724b28771c4acaadf1f74e8114b12a.zip
opensim-SC_OLD-83ed435d01724b28771c4acaadf1f74e8114b12a.tar.gz
opensim-SC_OLD-83ed435d01724b28771c4acaadf1f74e8114b12a.tar.bz2
opensim-SC_OLD-83ed435d01724b28771c4acaadf1f74e8114b12a.tar.xz
fixed potential reference invalidation and array out of bounds exception in basicphysics
Diffstat (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index a7f7877..eb9590a 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -120,8 +120,10 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
120 } 120 }
121 public override void Simulate(float timeStep) 121 public override void Simulate(float timeStep)
122 { 122 {
123 foreach (BasicActor actor in _actors) 123 for (int i = 0; i < _actors.Count; ++i)
124 { 124 {
125 BasicActor actor = _actors[i];
126
125 actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep); 127 actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep);
126 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep); 128 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep);
127 if (actor.Position.Y < 0) 129 if (actor.Position.Y < 0)
@@ -137,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
137 { 139 {
138 actor.Position.X = 0.1F; 140 actor.Position.X = 0.1F;
139 } 141 }
140 else if (actor.Position.X > 256) 142 else if (actor.Position.X >= 256)
141 { 143 {
142 actor.Position.X = 255.9F; 144 actor.Position.X = 255.9F;
143 } 145 }