[Orxonox-commit 4631] r9302 - code/branches/presentation2012merge/src/modules/pickup
landauf at orxonox.net
landauf at orxonox.net
Sun Jun 17 18:24:06 CEST 2012
Author: landauf
Date: 2012-06-17 18:24:06 +0200 (Sun, 17 Jun 2012)
New Revision: 9302
Modified:
code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.cc
code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.h
code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc
Log:
small cleanup. calling addTemplate() only once instead of twice
Modified: code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.cc 2012-06-16 13:23:01 UTC (rev 9301)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.cc 2012-06-17 16:24:06 UTC (rev 9302)
@@ -150,27 +150,25 @@
@return
Returns a pointer to the StaticEntity.
*/
- StaticEntity* PickupRepresentation::getSpawnerRepresentation(PickupSpawner* spawner)
+ StaticEntity* PickupRepresentation::createSpawnerRepresentation(PickupSpawner* spawner)
{
if(this->spawnerRepresentation_ == NULL)
{
orxout(verbose, context::pickups) << "PickupRepresentation: No spawner representation found." << endl;
if(this->spawnerTemplate_ == "")
{
- orxout(verbose, context::pickups) << "PickupRepresentation: Spawner template is empty." << endl;
+ orxout(internal_warning, context::pickups) << "PickupRepresentation: Spawner template is empty." << endl;
// If neither spawnerRepresentation nor spawnerTemplate was specified
return this->getDefaultSpawnerRepresentation(spawner);
}
this->addTemplate(this->spawnerTemplate_);
}
- StaticEntity* representation = this->spawnerRepresentation_;
- representation->setVisible(true);
+ this->spawnerRepresentation_->setVisible(true);
+ StaticEntity* temp = this->spawnerRepresentation_;
+ this->spawnerRepresentation_ = NULL;
- this->addTemplate(this->spawnerTemplate_);
- this->spawnerRepresentation_->setVisible(false);
-
- return representation;
+ return temp;
}
/**
Modified: code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.h
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.h 2012-06-16 13:23:01 UTC (rev 9301)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupRepresentation.h 2012-06-17 16:24:06 UTC (rev 9302)
@@ -140,7 +140,7 @@
inline const Pickupable* getPickup(unsigned int index) const
{ if(index == 0) return this->pickup_; return NULL; }
- StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner.
+ StaticEntity* createSpawnerRepresentation(PickupSpawner* spawner); //!< Create a spawnerRepresentation for a specific PickupSpawner.
protected:
/**
Modified: code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc 2012-06-16 13:23:01 UTC (rev 9301)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc 2012-06-17 16:24:06 UTC (rev 9302)
@@ -95,7 +95,7 @@
else
{
PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
- this->attach(representation->getSpawnerRepresentation(this));
+ this->attach(representation->createSpawnerRepresentation(this));
this->setActive(true);
}
}
@@ -149,7 +149,7 @@
else
{
PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
- this->attach(representation->getSpawnerRepresentation(this));
+ this->attach(representation->createSpawnerRepresentation(this));
this->setActive(true);
}
}
More information about the Orxonox-commit
mailing list