[Orxonox-commit 1766] r6484 - in code/branches/pickup3/src: modules/pickup modules/pickup/items orxonox/pickup
dafrick at orxonox.net
dafrick at orxonox.net
Sun Mar 7 23:00:05 CET 2010
Author: dafrick
Date: 2010-03-07 23:00:05 +0100 (Sun, 07 Mar 2010)
New Revision: 6484
Modified:
code/branches/pickup3/src/modules/pickup/PickupManager.cc
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/pickup/PickupIdentifier.cc
Log:
Cleanup and bug fixes.
Modified: code/branches/pickup3/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupManager.cc 2010-03-07 21:20:51 UTC (rev 6483)
+++ code/branches/pickup3/src/modules/pickup/PickupManager.cc 2010-03-07 22:00:05 UTC (rev 6484)
@@ -51,6 +51,8 @@
*/
PickupManager::PickupManager()
{
+ this->defaultRepresentation_ = NULL;
+ this->pickupCarrierStructure_ = NULL;
RegisterRootObject(PickupManager);
this->defaultRepresentation_ = new PickupRepresentation();
@@ -84,7 +86,7 @@
//TODO: Make sure that either the PickupRepresentation is destroyed upon destruction of the PickupManager if the representation wasn't created with XMLPort.
bool PickupManager::registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation)
{
- if(this->representations_.find(identifier) == this->representations_.end()) //!< If the Pickupable already has a RepresentationRegistered.
+ if(this->representations_.find(identifier) != this->representations_.end()) //!< If the Pickupable already has a RepresentationRegistered.
return false;
this->representations_[identifier] = representation;
Modified: code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc 2010-03-07 21:20:51 UTC (rev 6483)
+++ code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc 2010-03-07 22:00:05 UTC (rev 6484)
@@ -102,6 +102,11 @@
XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode);
PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this); //!< Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents.
+
+ if(this->spawnerRepresentation_ != NULL)
+ this->spawnerRepresentation_->setVisible(false);
+
+ COUT(4) << "PickupRepresentation created: name: '" << this->name_ << "', description: '" << this->description_ << "', spawnerTemplate: '" << this->spawnerTemplate_ << "'." << std::endl;
}
/**
@@ -127,8 +132,10 @@
}
StaticEntity* representation = this->spawnerRepresentation_;
+ representation->setVisible(true);
this->addTemplate(this->spawnerTemplate_);
+ this->spawnerRepresentation_->setVisible(false);
return representation;
}
Modified: code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupSpawner.cc 2010-03-07 21:20:51 UTC (rev 6483)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.cc 2010-03-07 22:00:05 UTC (rev 6484)
@@ -146,7 +146,9 @@
else
{
PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
+ representation->setVisible(this->isActive());
this->attach(representation->getSpawnerRepresentation(this));
+ this->setActive(true);
}
}
@@ -272,8 +274,11 @@
//TODO: Make more generic -> without pawn.
void PickupSpawner::trigger(Pawn* pawn)
{
- if (this->isActive()) //!< Checks whether PickupItem is active.
+ COUT(1) << "PickupSpawner triggered." << std::endl;
+ if (this->isActive()) //!< Checks whether PickupSpawner is active.
{
+ COUT(1) << "PickupSpawner triggered and active." << std::endl;
+
PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
if(carrier == NULL)
{
Modified: code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc 2010-03-07 21:20:51 UTC (rev 6483)
+++ code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc 2010-03-07 22:00:05 UTC (rev 6484)
@@ -120,8 +120,6 @@
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/pickup/PickupIdentifier.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.cc 2010-03-07 21:20:51 UTC (rev 6483)
+++ code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.cc 2010-03-07 22:00:05 UTC (rev 6484)
@@ -100,7 +100,7 @@
*/
bool PickupIdentifier::addParameter(std::string & name, std::string & value)
{
- COUT(1) << "PickupIdentifier " << name << ", " << value << std::endl;
+ COUT(4) << "PickupIdentifier " << name << ", " << value << std::endl;
if(!(this->parameters_.find(name) == this->parameters_.end()))
{
More information about the Orxonox-commit
mailing list