Index: code/branches/ppspickups2/src/modules/pickup/items/InvisiblePickup.cc
===================================================================
--- code/branches/ppspickups2/src/modules/pickup/items/InvisiblePickup.cc	(revision 6684)
+++ code/branches/ppspickups2/src/modules/pickup/items/InvisiblePickup.cc	(revision 6708)
@@ -55,6 +55,6 @@
     {
         RegisterObject(InvisiblePickup);
-	//! Defines who is allowed to pick up the pickup.
-	this->initialize(); 
+        //! Defines who is allowed to pick up the pickup.
+        this->initialize(); 
     }
     
@@ -70,9 +70,9 @@
     void InvisiblePickup::initializeIdentifier(void)
     {
-	std::stringstream stream;
-	stream << this->getDuration();
-	std::string type1 = "duration";
-	std::string val1 = stream.str();
-	this->pickupIdentifier_->addParameter(type1, val1);
+        std::stringstream stream;
+        stream << this->getDuration();
+        std::string type1 = "duration";
+        std::string val1 = stream.str();
+        this->pickupIdentifier_->addParameter(type1, val1);
     }
     
@@ -83,6 +83,6 @@
     void InvisiblePickup::initialize(void)
     {
-	this->duration_ = 0.0;
-	this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
+        this->duration_ = 0.0f;
+        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
     }
 
@@ -94,7 +94,7 @@
     {
         SUPER(InvisiblePickup, XMLPort, xmlelement, mode);    
-	XMLPortParam(InvisiblePickup, "duration", setDuration, getDuration, xmlelement, mode);
-	 
-	 this->initializeIdentifier();
+        XMLPortParam(InvisiblePickup, "duration", setDuration, getDuration, xmlelement, mode);
+        
+        this->initializeIdentifier();
     }
     
@@ -106,17 +106,20 @@
     {
         SUPER(InvisiblePickup, changedUsed);
-	
         
         //! If the pickup is not picked up nothing must be done.
         if(!this->isPickedUp())
             return;
-	if (this->isUsed())
-	{
-	    this->startPickupTimer(this->getDuration());
-	    this->setInvisible(true);
-	}
-	else
-	  this->setInvisible(false);
-	
+        
+        if (this->isUsed())
+        {
+            this->startPickupTimer(this->getDuration());
+            this->setInvisible(true);
+        }
+        else
+        {
+            this->setInvisible(false);
+            this->destroy();
+        }
+        
     }
     
@@ -151,8 +154,8 @@
         
         SUPER(InvisiblePickup, clone, item);
-	
-	InvisiblePickup* pickup = dynamic_cast<InvisiblePickup*>(item);
-	pickup->setDuration(this->getDuration());
-	pickup->initializeIdentifier();
+        
+        InvisiblePickup* pickup = dynamic_cast<InvisiblePickup*>(item);
+        pickup->setDuration(this->getDuration());
+        pickup->initializeIdentifier();
     }
     
@@ -160,37 +163,39 @@
     @brief
         Sets the invisibility.
-    @param health
+    @param invisibility
         The invisibility.
     */
     bool InvisiblePickup::setInvisible(bool invisibility)
     {
-      
-      Pawn* pawn = this->carrierToPawnHelper();
-      pawn->setVisible(!invisibility);
-      return 0;
-    }
-    
-    /**
-    @brief
-    Sets the duration.
+        Pawn* pawn = this->carrierToPawnHelper();
+        if(pawn == NULL)
+            return false;
+        
+        pawn->setVisible(!invisibility);
+        return true;
+    }
+    
+    /**
+    @brief
+        Sets the duration.
     @param duration
-    The duration
+        The duration
     */
     void InvisiblePickup::setDuration(float duration)
     {
-	if(duration >= 0.0f)
-	{
-	    this->duration_ = duration;
-	}
-	else
-	{
-	    COUT(1) << "Invalid duration in InvisiblePickup." << std::endl;
-	    this->duration_ = 0;
-	}
-    }
-    
-    void InvisiblePickup::PickupTimerCallBack(void)
-    {
-	this->setInvisible(false);
+        if(duration >= 0.0f)
+        {
+            this->duration_ = duration;
+        }
+        else
+        {
+            COUT(1) << "Invalid duration in InvisiblePickup." << std::endl;
+            this->duration_ = 0.0f;
+        }
+    }
+    
+    void InvisiblePickup::pickupTimerCallback(void)
+    {
+        this->setUsed(false);
     }
 
