[Orxonox-commit 3136] r7829 - code/branches/tutoriallevel/src/modules/objects/triggers
dafrick at orxonox.net
dafrick at orxonox.net
Thu Jan 13 23:43:21 CET 2011
Author: dafrick
Date: 2011-01-13 23:43:20 +0100 (Thu, 13 Jan 2011)
New Revision: 7829
Modified:
code/branches/tutoriallevel/src/modules/objects/triggers/MultiTrigger.cc
code/branches/tutoriallevel/src/modules/objects/triggers/TriggerBase.h
Log:
Fixing small bug in MultiTrigger.
Modified: code/branches/tutoriallevel/src/modules/objects/triggers/MultiTrigger.cc
===================================================================
--- code/branches/tutoriallevel/src/modules/objects/triggers/MultiTrigger.cc 2011-01-13 20:56:25 UTC (rev 7828)
+++ code/branches/tutoriallevel/src/modules/objects/triggers/MultiTrigger.cc 2011-01-13 22:43:20 UTC (rev 7829)
@@ -197,14 +197,13 @@
// If the activity is different from what it is now, change it and fire an Event.
if(bActive ^ this->isActive(state->originator))
{
-
bool bFire = true;
// Add the originator to the objects activating this MultiTrigger.
if(bActive == true)
{
// If the MultiTrigger has not exceeded its remaining activations.
- if(this->remainingActivations_ > 0)
+ if(this->hasRemainingActivations())
{
this->active_.insert(state->originator);
if(this->remainingActivations_ != INF_s)
@@ -217,7 +216,7 @@
else
{
// If the MultiTrigger doesn't stay active or hasn't' exceeded its remaining activations.
- if(!this->getStayActive() || this->remainingActivations_ > 0)
+ if(!this->getStayActive() || this->hasRemainingActivations())
this->active_.erase(state->originator);
else
bFire = false;
Modified: code/branches/tutoriallevel/src/modules/objects/triggers/TriggerBase.h
===================================================================
--- code/branches/tutoriallevel/src/modules/objects/triggers/TriggerBase.h 2011-01-13 20:56:25 UTC (rev 7828)
+++ code/branches/tutoriallevel/src/modules/objects/triggers/TriggerBase.h 2011-01-13 22:43:20 UTC (rev 7829)
@@ -132,6 +132,12 @@
*/
inline int getActivations(void) const
{ return this->remainingActivations_; }
+ /**
+ @brief Check whether the trigger has still at least one remaining activation.
+ @return Returns true if the trigger has remaining activations (i.e. the number of remaining activations is not zero).
+ */
+ inline bool hasRemainingActivations(void) const
+ { return this->remainingActivations_ > 0 || this->remainingActivations_ == INF_s; }
/**
@brief Set the invert-mode of triggerhe trigger.
More information about the Orxonox-commit
mailing list