From 83ed435d01724b28771c4acaadf1f74e8114b12a Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 20 Nov 2007 05:09:30 +0000 Subject: fixed potential reference invalidation and array out of bounds exception in basicphysics --- OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin') 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 } public override void Simulate(float timeStep) { - foreach (BasicActor actor in _actors) + for (int i = 0; i < _actors.Count; ++i) { + BasicActor actor = _actors[i]; + actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep); actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep); if (actor.Position.Y < 0) @@ -137,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin { actor.Position.X = 0.1F; } - else if (actor.Position.X > 256) + else if (actor.Position.X >= 256) { actor.Position.X = 255.9F; } -- cgit v1.1