fixed potential reference invalidation and array out of bounds exception in basicphysics

afrisby
Jeff Ames 2007-11-20 05:09:30 +00:00
parent 3aa73ae1c7
commit 83ed435d01
1 changed files with 4 additions and 2 deletions

View File

@ -120,8 +120,10 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
} }
public override void Simulate(float timeStep) 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.X = actor.Position.X + (actor.Velocity.X*timeStep);
actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep); actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep);
if (actor.Position.Y < 0) if (actor.Position.Y < 0)
@ -137,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{ {
actor.Position.X = 0.1F; actor.Position.X = 0.1F;
} }
else if (actor.Position.X > 256) else if (actor.Position.X >= 256)
{ {
actor.Position.X = 255.9F; actor.Position.X = 255.9F;
} }