[Orxonox-commit 2379] r7094 - in code/branches/presentation3/src: modules/pickup orxonox/interfaces

dafrick at orxonox.net dafrick at orxonox.net
Wed Jun 2 23:16:20 CEST 2010


Author: dafrick
Date: 2010-06-02 23:16:20 +0200 (Wed, 02 Jun 2010)
New Revision: 7094

Modified:
   code/branches/presentation3/src/modules/pickup/PickupCollection.cc
   code/branches/presentation3/src/orxonox/interfaces/Pickupable.cc
   code/branches/presentation3/src/orxonox/interfaces/Pickupable.h
Log:
(Hopefully) fix in pickups.


Modified: code/branches/presentation3/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/branches/presentation3/src/modules/pickup/PickupCollection.cc	2010-06-02 20:45:14 UTC (rev 7093)
+++ code/branches/presentation3/src/modules/pickup/PickupCollection.cc	2010-06-02 21:16:20 UTC (rev 7094)
@@ -122,7 +122,7 @@
         //! Change the PickupCarrier for all Pickupables this PickupCollection consists of.
         for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
         {
-            (*it).get()->setCarrier(this->getCarrier()->getTarget(*it));
+            (*it).get()->setCarrier(this->getCarrier()->getTarget(*it), true);
         }
     }
     

Modified: code/branches/presentation3/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/branches/presentation3/src/orxonox/interfaces/Pickupable.cc	2010-06-02 20:45:14 UTC (rev 7093)
+++ code/branches/presentation3/src/orxonox/interfaces/Pickupable.cc	2010-06-02 21:16:20 UTC (rev 7094)
@@ -212,7 +212,7 @@
     @param carrier
         Sets the input PickupCarrier as the carrier of the pickup.
     */
-    inline bool Pickupable::setCarrier(PickupCarrier* carrier)
+    inline bool Pickupable::setCarrier(PickupCarrier* carrier, bool tell)
     {
         if(this->carrier_ == carrier)
             return false;
@@ -221,6 +221,8 @@
         
         this->carrier_ = carrier;
         this->changedCarrier();
+        if(tell && carrier != NULL)
+            this->carrier_->pickups_.insert(this);
         return true;
     }
     

Modified: code/branches/presentation3/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/branches/presentation3/src/orxonox/interfaces/Pickupable.h	2010-06-02 20:45:14 UTC (rev 7093)
+++ code/branches/presentation3/src/orxonox/interfaces/Pickupable.h	2010-06-02 21:16:20 UTC (rev 7094)
@@ -114,7 +114,7 @@
                 
             bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
             bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up.
-            bool setCarrier(PickupCarrier* carrier); //!< Sets the carrier of the pickup.
+            bool setCarrier(PickupCarrier* carrier, bool tell = false); //!< Sets the carrier of the pickup.
             
         protected:
             /**




More information about the Orxonox-commit mailing list