[Orxonox-commit 4622] r9293 - in code/branches/presentation2012merge/src: modules/pickup orxonox/interfaces
dafrick at orxonox.net
dafrick at orxonox.net
Mon Jun 11 22:57:40 CEST 2012
Author: dafrick
Date: 2012-06-11 22:57:40 +0200 (Mon, 11 Jun 2012)
New Revision: 9293
Modified:
code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc
code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.cc
code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h
Log:
Should fix internal warnig (and compile error introduced in last commit)
Modified: code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc 2012-06-11 20:40:01 UTC (rev 9292)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc 2012-06-11 20:57:40 UTC (rev 9293)
@@ -74,6 +74,9 @@
// 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();
}
@@ -275,7 +278,7 @@
if(this->pickups_.size() >= index)
return NULL;
- std::list<CollectiblePickup*>::iterator it = this->pickups_.begin();
+ std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin();
std::advance(it, index);
return *it;
}
Modified: code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.cc 2012-06-11 20:40:01 UTC (rev 9292)
+++ code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.cc 2012-06-11 20:57:40 UTC (rev 9293)
@@ -103,7 +103,7 @@
*/
void Pickupable::destroyPickup(void)
{
- if(!this->beingDestroyed_)
+ if(!this->isBeingDestroyed())
this->OrxonoxClass::destroy();
else
orxout(internal_warning, context::pickups) << this->getIdentifier()->getName() << " may be unsafe. " << endl;
Modified: code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h 2012-06-11 20:40:01 UTC (rev 9292)
+++ code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h 2012-06-11 20:57:40 UTC (rev 9293)
@@ -173,6 +173,13 @@
{ this->enabled_ = false; }
/**
+ @brief Check whether the Pickupable is in the process of being destroyed.
+ @return Returns true if so.
+ */
+ inline bool isBeingDestroyed(void)
+ { return this->beingDestroyed_; }
+
+ /**
@brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.:
DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance);
More information about the Orxonox-commit
mailing list