Index: code/branches/cpp11_v3/src/modules/objects/ForceField.cc
===================================================================
--- code/branches/cpp11_v3/src/modules/objects/ForceField.cc	(revision 11053)
+++ code/branches/cpp11_v3/src/modules/objects/ForceField.cc	(revision 11054)
@@ -118,5 +118,5 @@
         {
             // Iterate over all objects that could possibly be affected by the ForceField.
-            for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
+            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
             {
                 // The direction of the orientation of the force field.
@@ -125,5 +125,5 @@
 
                 // Vector from the center of the force field to the object its acting on.
-                Vector3 distanceVector = it->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));
+                Vector3 distanceVector = mobileEntity->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));
 
                 // The object is outside a ball around the center with radius length/2 of the ForceField.
@@ -132,5 +132,5 @@
 
                 // The distance of the object form the orientation vector. (Or rather the smallest distance from the orientation vector)
-                float distanceFromDirectionVector = ((it->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();
+                float distanceFromDirectionVector = ((mobileEntity->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();
 
                 // If the object in a tube of radius 'radius' around the direction of orientation.
@@ -140,5 +140,5 @@
                 // Apply a force to the object in the direction of the orientation.
                 // The force is highest when the object is directly on the direction vector, with a linear decrease, finally reaching zero, when distanceFromDirectionVector = radius.
-                it->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);
+                mobileEntity->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);
             }
         }
@@ -146,7 +146,7 @@
         {
             // Iterate over all objects that could possibly be affected by the ForceField.
-            for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
-            {
-                Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
+            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
+            {
+                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
                 float distance = distanceVector.length();
                 // If the object is within 'radius' distance.
@@ -155,5 +155,5 @@
                     distanceVector.normalise();
                     // Apply a force proportional to the velocity, with highest force at the origin of the sphere, linear decreasing until reaching a distance of 'radius' from the origin, where the force reaches zero. 
-                    it->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);
+                    mobileEntity->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);
                 }
             }
@@ -162,7 +162,7 @@
         {
             // Iterate over all objects that could possibly be affected by the ForceField.
-            for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
-            {
-                Vector3 distanceVector = this->getWorldPosition() - it->getWorldPosition();
+            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
+            {
+                Vector3 distanceVector = this->getWorldPosition() - mobileEntity->getWorldPosition();
                 float distance = distanceVector.length();
                 // If the object is within 'radius' distance and no more than 'length' away from the boundary of the sphere.
@@ -172,5 +172,5 @@
                     distanceVector.normalise();
                     // Apply a force proportional to the velocity, with highest force at the boundary of the sphere, linear decreasing until reaching a distance of 'radius-length' from the origin, where the force reaches zero.
-                    it->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);
+                    mobileEntity->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);
                 }
             }
@@ -179,7 +179,7 @@
         {
             // Iterate over all objects that could possibly be affected by the ForceField.
-            for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
-            {
-                Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
+            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
+            {
+                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
                 float distance = distanceVector.length();
                 // If the object is within 'radius' distance and especially further away than massRadius_
@@ -197,5 +197,5 @@
                     
                     // Note: this so called force is actually an acceleration!
-                    it->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);
+                    mobileEntity->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);
                 }
             }
@@ -204,7 +204,7 @@
         {
             // Iterate over all objects that could possibly be affected by the ForceField.
-            for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
-            {
-                Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
+            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
+            {
+                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
                 float distance = distanceVector.length();
                 if (distance < this->radius_ && distance > this->massRadius_)
@@ -212,5 +212,5 @@
                     // Add a Acceleration in forceDirection_.
                     // Vector3(0,0,0) is the direction, where the force should work.
-                    it->addAcceleration(forceDirection_ , Vector3(0,0,0));
+                    mobileEntity->addAcceleration(forceDirection_ , Vector3(0,0,0));
                 }
             }
