[Orxonox-commit 1760] r6478 - in code/branches/pickup3/src: modules/pickup modules/pickup/items orxonox/interfaces orxonox/pickup

dafrick at orxonox.net dafrick at orxonox.net
Sun Mar 7 10:55:24 CET 2010


Author: dafrick
Date: 2010-03-07 10:55:23 +0100 (Sun, 07 Mar 2010)
New Revision: 6478

Modified:
   code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc
   code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
   code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc
   code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc
   code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.cc
Log:
More bug fixes.


Modified: code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc	2010-03-06 18:44:04 UTC (rev 6477)
+++ code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc	2010-03-07 09:55:23 UTC (rev 6478)
@@ -45,6 +45,8 @@
     */
     PickupRepresentation::PickupRepresentation() : BaseObject(this)
     {
+        this->spawnerRepresentation_ = NULL;
+        
         RegisterObject(PickupRepresentation);
         
         this->initialize();
@@ -56,6 +58,8 @@
     */
     PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator)
     {
+        this->spawnerRepresentation_ = NULL;
+        
         RegisterObject(PickupRepresentation);
         
         this->initialize();
@@ -80,7 +84,6 @@
         this->description_ = "This is a pickup.";
         this->name_ = "Pickup";
         this->spawnerTemplate_ = "";
-        this->spawnerRepresentation_ = NULL;
         this->pickup_ = NULL;
     }
     

Modified: code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupSpawner.cc	2010-03-06 18:44:04 UTC (rev 6477)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.cc	2010-03-07 09:55:23 UTC (rev 6478)
@@ -117,7 +117,7 @@
     PickupSpawner::~PickupSpawner()
     {
         if(this->pickup_ != NULL)
-            delete this->pickup_;
+            this->pickup_->destroy();
     }
 
     /**

Modified: code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc	2010-03-06 18:44:04 UTC (rev 6477)
+++ code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc	2010-03-07 09:55:23 UTC (rev 6478)
@@ -79,7 +79,6 @@
         this->healthType_ = pickupHealthType::limited;
         this->maxHealthSave_ = 0;
         this->maxHealthOverwrite_ = 0;
-        
     }
     
     /**
@@ -123,6 +122,8 @@
         if(!this->isContinuous())
             this->healthRate_ = 0.0;
         
+        COUT(1) << "HealthPickup " << this->getHealth() << ", " << this->getHealthRate() << ", " << this->getHealthType() << "." << std::endl;
+        
         this->initializeIdentifier();
     }
     

Modified: code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc	2010-03-06 18:44:04 UTC (rev 6477)
+++ code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc	2010-03-07 09:55:23 UTC (rev 6478)
@@ -47,10 +47,11 @@
     */
     Pickupable::Pickupable()
     {
-        RegisterRootObject(Pickupable);
-
         this->used_ = false;
         this->pickedUp_ = false;
+        
+        RegisterRootObject(Pickupable);
+        
         this->carrier_ = NULL;
         
         this->pickupIdentifier_ = new PickupIdentifier();
@@ -65,7 +66,7 @@
         if(this->isUsed())
             this->setUsed(false);
         
-        if(this->isPickedUp())
+        if(this->isPickedUp() && this->getCarrier() != NULL)
         {
             this->getCarrier()->drop(this, false);
             this->setCarrier(NULL);

Modified: code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.cc	2010-03-06 18:44:04 UTC (rev 6477)
+++ code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.cc	2010-03-07 09:55:23 UTC (rev 6478)
@@ -110,9 +110,11 @@
     */
     bool PickupIdentifier::addParameter(std::string & name, std::string & value)
     {
+        COUT(1) << "PickupIdentifier " << name << ", " << value << std::endl;
+        
         if(!(this->parameters_.find(name) == this->parameters_.end()))
         {
-            COUT(2) << "Request for adding a parameter that already exists for the PickupIdentififer was denied." << std::endl;
+            COUT(2) << "Request for adding a parameter that already exists for the PickupIdentififer was denied. name: '" << name << "', value: '" << value << "'."<<  std::endl;
             return false;
         }
         




More information about the Orxonox-commit mailing list