Index: code/trunk/src/modules/pickup/items/ShieldPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/ShieldPickup.cc	(revision 7208)
+++ code/trunk/src/modules/pickup/items/ShieldPickup.cc	(revision 7547)
@@ -34,14 +34,10 @@
 #include "ShieldPickup.h"
 
+#include <sstream>
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
-#include "util/StringUtils.h"
-
-#include "worldentities/pawns/SpaceShip.h"
-#include "items/Engine.h"
+
 #include "pickup/PickupIdentifier.h"
-
-#include <sstream>
-
+#include "worldentities/pawns/Pawn.h"
 
 namespace orxonox
@@ -67,22 +63,4 @@
     {
 
-    }
-
-    /**
-    @brief
-    Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
-    @return
-    A pointer to the Pawn, or NULL if the conversion failed.
-    */
-    Pawn* ShieldPickup::carrierToPawnHelper(void)
-    {
-        PickupCarrier* carrier = this->getCarrier();
-        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
-
-        if(pawn == NULL)
-        {
-            COUT(1) << "Invalid PickupCarrier in ShieldPickup." << std::endl;
-        }
-        return pawn;
     }
 
@@ -134,7 +112,7 @@
         SUPER(ShieldPickup, XMLPort, xmlelement, mode);
 
-        XMLPortParam(ShieldPickup, "duration", setDuration, getDuration, xmlelement, mode);
         XMLPortParam(ShieldPickup, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode);
         XMLPortParam(ShieldPickup, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode);
+        XMLPortParam(ShieldPickup, "duration", setDuration, getDuration, xmlelement, mode);
 
         this->initializeIdentifier();
@@ -149,5 +127,5 @@
         SUPER(ShieldPickup, changedUsed);
 
-        //! If the pickup is not picked up nothing must be done.
+        // If the pickup is not picked up nothing must be done.
         if(!this->isPickedUp())
             return;
@@ -157,14 +135,18 @@
             this->Pickupable::destroy();
 
-        //! If the pickup has transited to used.
+        // If the pickup has transited to used.
         if(this->isUsed())
         {
-            if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
+            // If its durationType is continuous, we set a Timer to be reminded, when the time has run out.
+            if(this->isContinuous())
             {
-                this->durationTimer_.unpauseTimer();
-            }
-            else
-            {
-                this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&ShieldPickup::pickupTimerCallback, this)));
+                if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
+                {
+                    this->durationTimer_.unpauseTimer();
+                }
+                else
+                {
+                    this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&ShieldPickup::pickupTimerCallback, this)));
+                }
             }
             pawn->setShieldAbsorption(this->getShieldAbsorption());
@@ -177,16 +159,33 @@
             pawn->setShieldHealth(0.0f);
 
-            if(this->isOnce())
+            // We destroy the pickup if either, the pickup has activationType immediate and durationType once or it has durationType continuous and the duration was exceeded.
+            if((!this->isContinuous() && this->isImmediate()) || (this->isContinuous() && !this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration()))
             {
-                if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration())
-                {
-                    this->Pickupable::destroy();
-                }
-                else
-                {
-                    this->durationTimer_.pauseTimer();
-                }
+                this->Pickupable::destroy();
             }
-        }
+            // We pause the Timer if the pickup is continuous and the duration is not yet exceeded,
+            else if(this->isContinuous() && this->durationTimer_.isActive())
+            {
+                this->durationTimer_.pauseTimer();
+            }
+        }
+    }
+
+    /**
+    @brief
+    Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+    @return
+    A pointer to the Pawn, or NULL if the conversion failed.
+    */
+    Pawn* ShieldPickup::carrierToPawnHelper(void)
+    {
+        PickupCarrier* carrier = this->getCarrier();
+        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
+
+        if(pawn == NULL)
+        {
+            COUT(1) << "Invalid PickupCarrier in ShieldPickup." << std::endl;
+        }
+        return pawn;
     }
 
@@ -213,7 +212,45 @@
     /**
     @brief
-    Sets the percentage the shield absorbs of the dealt damage.
+        Sets the duration.
+    @param duration
+        The duration in seconds.
+    */
+    void ShieldPickup::setDuration(float duration)
+    {
+        if(duration >= 0.0f)
+        {
+            this->duration_ = duration;
+        }
+        else
+        {
+            COUT(1) << "Invalid duration in ShieldPickup." << std::endl;
+            this->duration_ = 0.0f;
+        }
+    }
+
+    /**
+    @brief
+        Sets the health of the shield.
+    @param shieldHealth
+        The shieldHealth.
+    */
+    void ShieldPickup::setShieldHealth(float shieldHealth)
+    {
+        if (shieldHealth>=0)
+        {
+            this->shieldHealth_=shieldHealth;
+        }
+        else
+        {
+            COUT(1) << "Invalid Shieldhealth in ShieldPickup." << std::endl;
+            this->shieldHealth_=0;
+        }
+    }
+
+    /**
+    @brief
+        Sets the percentage the shield absorbs of the dealt damage.
     @param shieldAbsorption
-    The shieldAbsorption. Has to be between 0 and 1
+        The shieldAbsorption. Has to be between 0 and 1.
     */
     void ShieldPickup::setShieldAbsorption(float shieldAbsorption)
@@ -232,40 +269,6 @@
     /**
     @brief
-    Sets the health of the shield.
-    @param shieldHealth
-    The shieldHealth
-    */
-    void ShieldPickup::setShieldHealth(float shieldHealth)
-    {
-        if (shieldHealth>=0)
-        {
-            this->shieldHealth_=shieldHealth;
-        }
-        else
-        {
-            COUT(1) << "Invalid Shieldhealth in ShieldPickup." << std::endl;
-            this->shieldHealth_=0;
-        }
-    }
-
-    /**
-    @brief
-        Sets the duration.
-    @param duration
-        The duration
-    */
-    void ShieldPickup::setDuration(float duration)
-    {
-        if(duration >= 0.0f)
-        {
-            this->duration_ = duration;
-        }
-        else
-        {
-            COUT(1) << "Invalid duration in ShieldPickup." << std::endl;
-            this->duration_ = 0.0f;
-        }
-    }
-
+        Helper method. Is called by the Timer as soon as it expires.
+    */
     void ShieldPickup::pickupTimerCallback(void)
     {
