Index: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	(revision 10624)
+++ code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	(revision 11071)
@@ -53,5 +53,5 @@
     RegisterClass(ModularSpaceShip);
 
-    std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;
+    std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = nullptr;
 
     ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context)
@@ -94,18 +94,18 @@
         for (unsigned int i=0; i < this->getAttachedObjects().size(); i++)
         {
-            if (this->getAttachedObject(i) == NULL)
+            if (this->getAttachedObject(i) == nullptr)
             {
                 break;
             }
             // iterate through all attached parts
-            for(unsigned int j = 0; j < this->partList_.size(); j++)
+            for(ShipPart* part : this->partList_)
             {
                 // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
-                if((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
+                if((part->getName() == this->getAttachedObject(i)->getName()) && !part->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
                 {
                     // The Entity is added to the part's entityList_
-                    this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
+                    part->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
                     // An entry in the partMap_ is created, assigning the part to the entity.
-                    this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);
+                    this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), part);
                 }
             }
@@ -146,10 +146,10 @@
     ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
     {
-        for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
-        {
-            if (it->first == entity)
-                return it->second;
-        }
-        return NULL;
+        for (const auto& mapEntry : this->partMap_)
+        {
+            if (mapEntry.first == entity)
+                return mapEntry.second;
+        }
+        return nullptr;
     }
 
@@ -160,5 +160,5 @@
     void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
     {
-        if (cs != NULL && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
+        if (cs != nullptr && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != nullptr)
             this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
         else
@@ -174,9 +174,9 @@
     void ModularSpaceShip::killShipPartStatic(std::string name)
     {
-        for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)
-        {
-            if (it->second->getName() == name)
-            {
-                it->second->death();
+        for (const auto& mapEntry : *ModularSpaceShip::partMap_s)
+        {
+            if (mapEntry.second->getName() == name)
+            {
+                mapEntry.second->death();
                 return;
             }
@@ -193,9 +193,9 @@
     void ModularSpaceShip::killShipPart(std::string name)
     {
-        for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)
-        {
-            if (it->second->getName() == name)
-            {
-                it->second->death();
+        for (const auto& mapEntry : ModularSpaceShip::partMap_)
+        {
+            if (mapEntry.second->getName() == name)
+            {
+                mapEntry.second->death();
                 return;
             }
@@ -212,5 +212,5 @@
     void ModularSpaceShip::addShipPart(ShipPart* part)
     {
-        OrxAssert(part != NULL, "The ShipPart cannot be NULL.");
+        OrxAssert(part != nullptr, "The ShipPart cannot be nullptr.");
         this->partList_.push_back(part);
         part->setParent(this);
@@ -222,10 +222,10 @@
         Get the i-th ShipPart of the SpaceShip.
     @return
-        Returns a pointer to the i-the ShipPart. NULL if there is no ShipPart with that index.
+        Returns a pointer to the i-the ShipPart. nullptr if there is no ShipPart with that index.
     */
     ShipPart* ModularSpaceShip::getShipPart(unsigned int index)
     {
         if(this->partList_.size() <= index)
-            return NULL;
+            return nullptr;
         else
             return this->partList_[index];
@@ -238,17 +238,17 @@
         The name of the ShipPart to be returned.
     @return
-        Pointer to the ShipPart with the given name, or NULL if not found.
+        Pointer to the ShipPart with the given name, or nullptr if not found.
     */
     ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
     {
-        for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
-        {
-            if(orxonox_cast<ShipPart*>(*it)->getName() == name)
-            {
-                return orxonox_cast<ShipPart*>(*it);
+        for(ShipPart* part : this->partList_)
+        {
+            if(orxonox_cast<ShipPart*>(part)->getName() == name)
+            {
+                return orxonox_cast<ShipPart*>(part);
             }
         }
         orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
-        return NULL;
+        return nullptr;
     }
 
@@ -256,12 +256,12 @@
     @brief
         Check whether the SpaceShip has a particular Engine.
-    @param engine
+    @param search
         A pointer to the Engine to be checked.
     */
-    bool ModularSpaceShip::hasShipPart(ShipPart* part) const
-    {
-        for(unsigned int i = 0; i < this->partList_.size(); i++)
-        {
-            if(this->partList_[i] == part)
+    bool ModularSpaceShip::hasShipPart(ShipPart* search) const
+    {
+        for(ShipPart* part : this->partList_)
+        {
+            if(part == search)
                 return true;
         }
