[Orxonox-commit 4623] r9294 - in code/branches/presentation2012merge/src: modules/pickup orxonox/pickup

landauf at orxonox.net landauf at orxonox.net
Tue Jun 12 23:05:15 CEST 2012


Author: landauf
Date: 2012-06-12 23:05:15 +0200 (Tue, 12 Jun 2012)
New Revision: 9294

Modified:
   code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc
   code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.cc
   code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.h
Log:
removed 2 lines from ~PickupCollection() again because they don't solve the real issue
use destroy() for PickupCollectionIdentifier because it's an OrxonoxClass
calling this->destroy() should be the last thing you do in a function
details in PickupIdentifier

Modified: code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc	2012-06-11 20:57:40 UTC (rev 9293)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc	2012-06-12 21:05:15 UTC (rev 9294)
@@ -74,16 +74,13 @@
         // Destroy all Pickupables constructing this PickupCollection.
         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
         {
-            if((*it)->isBeingDestroyed())
-                continue;
-
             (*it)->wasRemovedFromCollection();
             (*it)->destroyPickup();
         }
         this->pickups_.clear();
 
         if(this->pickupCollectionIdentifier_ != NULL)
-            delete this->pickupCollectionIdentifier_;
+            this->pickupCollectionIdentifier_->destroy();
     }
 
     /**
@@ -186,9 +183,7 @@
         // If at least all the enabled pickups of this PickupCollection are no longer picked up.
         if(this->pickedUpCounter_ <= this->disabledCounter_ && this->isPickedUp())
             this->Pickupable::destroy();
-
-        // If the PickupCollection is no longer picked up.
-        if(!this->isPickedUp())
+        else if(!this->isPickedUp()) // If the PickupCollection is no longer picked up.
             this->pickedUpCounter_ = 0;
     }
 

Modified: code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.cc
===================================================================
--- code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.cc	2012-06-11 20:57:40 UTC (rev 9293)
+++ code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.cc	2012-06-12 21:05:15 UTC (rev 9294)
@@ -112,7 +112,7 @@
     @return
         Returns false if the parameter already existed, true if not.
     */
-    bool PickupIdentifier::addParameter(std::string & name, std::string & value)
+    bool PickupIdentifier::addParameter(const std::string& name, const std::string& value)
     {
         orxout(verbose, context::pickups) << "PickupIdentifier " << name << ", " << value << endl;
 

Modified: code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.h
===================================================================
--- code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.h	2012-06-11 20:57:40 UTC (rev 9293)
+++ code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.h	2012-06-12 21:05:15 UTC (rev 9294)
@@ -71,7 +71,7 @@
 
             virtual int compare(const PickupIdentifier* identifier) const; //!< Compares two PickupIdentifiers and returns 0 if a == b, <0 if a < b and >0 if a > b for a.compare(b).
 
-            bool addParameter(std::string & name, std::string & value); //!< Add a parameter to the PickupIdentifier.
+            bool addParameter(const std::string& name, const std::string& value); //!< Add a parameter to the PickupIdentifier.
 
         private:
             Pickupable* pickup_; //!< The Pickupable the PickupIdentififer is for.




More information about the Orxonox-commit mailing list