Changeset 5831 for code/branches/core5/src
- Timestamp:
- Sep 28, 2009, 10:48:47 PM (15 years ago)
- Location:
- code/branches/core5/src
- Files:
-
- 53 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/tools/Timer.cc
r5798 r5831 42 42 SetConsoleCommandShortcutExtern(killdelays); 43 43 44 static std::set< StaticTimer*> delaytimerset;44 static std::set<Timer*> delaytimerset; 45 45 46 46 /** … … 51 51 void delay(float delay, const std::string& command) 52 52 { 53 StaticTimer *delaytimer = new StaticTimer();53 Timer* delaytimer = new Timer(); 54 54 delaytimerset.insert(delaytimer); 55 55 … … 64 64 @param command The command to execute 65 65 */ 66 void executeDelayedCommand( StaticTimer* timer, const std::string& command)66 void executeDelayedCommand(Timer* timer, const std::string& command) 67 67 { 68 68 CommandExecutor::execute(command); … … 76 76 void killdelays() 77 77 { 78 for (std::set< StaticTimer*>::iterator it = delaytimerset.begin(); it != delaytimerset.end(); ++it)78 for (std::set<Timer*>::iterator it = delaytimerset.begin(); it != delaytimerset.end(); ++it) 79 79 (*it)->destroy(); 80 80 … … 85 85 @brief Constructor: Sets the default-values. 86 86 */ 87 TimerBase::TimerBase() 87 Timer::Timer() 88 { 89 this->init(); 90 RegisterObject(Timer); 91 } 92 93 /** 94 @brief Constructor: Initializes the Timer with given values. 95 @param interval The timer-interval in seconds 96 @param bLoop If true, the function gets called every 'interval' seconds 97 @param exeuctor A executor of the function to call 98 */ 99 Timer::Timer(float interval, bool bLoop, Executor* executor, bool bKillAfterCall) 100 { 101 this->init(); 102 RegisterObject(Timer); 103 104 this->setTimer(interval, bLoop, executor, bKillAfterCall); 105 } 106 107 /** 108 @brief Deletes the executor. 109 */ 110 Timer::~Timer() 111 { 112 this->deleteExecutor(); 113 } 114 115 /** 116 @brief Initializes the Timer 117 */ 118 void Timer::init() 88 119 { 89 120 this->executor_ = 0; … … 94 125 95 126 this->time_ = 0; 96 97 RegisterObject(TimerBase);98 }99 100 /**101 @brief Deletes the executor.102 */103 TimerBase::~TimerBase()104 {105 this->deleteExecutor();106 127 } 107 128 … … 109 130 @brief Executes the executor. 110 131 */ 111 void Timer Base::run()132 void Timer::run() 112 133 { 113 134 bool temp = this->bKillAfterCall_; // to avoid errors with bKillAfterCall_=false and an exutors which destroy the timer … … 122 143 @brief Deletes the executor. 123 144 */ 124 void Timer Base::deleteExecutor()145 void Timer::deleteExecutor() 125 146 { 126 147 if (this->executor_) … … 131 152 @brief Updates the timer before the frames are rendered. 132 153 */ 133 void Timer Base::tick(const Clock& time)154 void Timer::tick(const Clock& time) 134 155 { 135 156 if (this->bActive_) -
code/branches/core5/src/libraries/tools/Timer.h
r5798 r5831 40 40 ClassName(); 41 41 void functionName(); 42 Timer <ClassName>myTimer;42 Timer myTimer; 43 43 }; 44 44 … … 48 48 ClassName::ClassName() 49 49 { 50 myTimer.setTimer(interval_in_seconds, bLoop, this, createExecutor(createFunctor(&ClassName::functionName)));50 myTimer.setTimer(interval_in_seconds, bLoop, createExecutor(createFunctor(&ClassName::functionName, this))); 51 51 } 52 52 … … 69 69 namespace orxonox 70 70 { 71 class StaticTimer;72 71 void delay(float delay, const std::string& command); 73 72 void killdelays(); 74 void executeDelayedCommand( StaticTimer* timer, const std::string& command);73 void executeDelayedCommand(Timer* timer, const std::string& command); 75 74 76 //! T imerBase is the parent of the Timer class.77 class _ToolsExport Timer Base: public TimeFactorListener75 //! The Timer is a callback-object, calling a given function after a given time-interval. 76 class _ToolsExport Timer : public TimeFactorListener 78 77 { 79 78 public: 80 ~TimerBase(); 79 Timer(); 80 ~Timer(); 81 82 Timer(float interval, bool bLoop, Executor* executor, bool bKillAfterCall = false); 83 84 /** 85 @brief Initializes the Timer with given values. 86 @param interval The timer-interval in seconds 87 @param bLoop If true, the function gets called every 'interval' seconds 88 @param object The object owning the timer and the function 89 @param executor A executor of the function to call 90 */ 91 void setTimer(float interval, bool bLoop, Executor* executor, bool bKillAfterCall = false) 92 { 93 this->deleteExecutor(); 94 95 this->setInterval(interval); 96 this->bLoop_ = bLoop; 97 this->executor_ = executor; 98 this->bActive_ = true; 99 100 this->time_ = this->interval_; 101 this->bKillAfterCall_ = bKillAfterCall; 102 } 81 103 82 104 void run(); … … 116 138 void tick(const Clock& time); 117 139 118 pr otected:119 TimerBase();120 140 private: 141 void init(); 142 121 143 Executor* executor_; //!< The executor of the function that should be called when the time expires 122 144 … … 128 150 long long time_; //!< Internal variable, counting the time till the next function-call 129 151 }; 130 131 //! The Timer is a callback-object, calling a given function after a given time-interval.132 template <class T = BaseObject>133 class Timer : public TimerBase134 {135 public:136 Timer() {}137 138 /**139 @brief Constructor: Initializes the Timer with given values.140 @param interval The timer-interval in seconds141 @param bLoop If true, the function gets called every 'interval' seconds142 @param object The object owning the timer and the function143 @param exeuctor A executor of the function to call144 */145 template <class O>146 Timer(float interval, bool bLoop, T* object, ExecutorMember<O>* exeuctor, bool bKillAfterCall = false)147 {148 this->setTimer(interval, bLoop, object, exeuctor, bKillAfterCall);149 }150 151 /**152 @brief Initializes the Timer with given values.153 @param interval The timer-interval in seconds154 @param bLoop If true, the function gets called every 'interval' seconds155 @param object The object owning the timer and the function156 @param exeuctor A executor of the function to call157 */158 template <class O>159 void setTimer(float interval, bool bLoop, T* object, ExecutorMember<O>* executor, bool bKillAfterCall = false)160 {161 this->deleteExecutor();162 163 this->setInterval(interval);164 this->bLoop_ = bLoop;165 executor->setObject(object);166 this->executor_ = static_cast<Executor*>(executor);167 this->bActive_ = true;168 169 this->time_ = this->interval_;170 this->bKillAfterCall_ = bKillAfterCall;171 }172 };173 174 //! The StaticTimer is a callback-object, calling a static function after a given time-interval.175 class _ToolsExport StaticTimer : public TimerBase176 {177 public:178 StaticTimer() {}179 180 /**181 @brief Constructor: Initializes the Timer with given values.182 @param interval The timer-interval in seconds183 @param bLoop If true, the function gets called every 'interval' seconds184 @param exeuctor A executor of the function to call185 */186 StaticTimer(float interval, bool bLoop, ExecutorStatic* executor, bool bKillAfterCall = false)187 {188 this->setTimer(interval, bLoop, executor, bKillAfterCall);189 }190 191 /**192 @brief Initializes the Timer with given values.193 @param interval The timer-interval in seconds194 @param bLoop If true, the function gets called every 'interval' seconds195 @param object The object owning the timer and the function196 @param executor A executor of the function to call197 */198 void setTimer(float interval, bool bLoop, ExecutorStatic* executor, bool bKillAfterCall = false)199 {200 this->deleteExecutor();201 202 this->setInterval(interval);203 this->bLoop_ = bLoop;204 this->executor_ = executor;205 this->bActive_ = true;206 207 this->time_ = this->interval_;208 this->bKillAfterCall_ = bKillAfterCall;209 }210 };211 212 152 } 213 153 -
code/branches/core5/src/libraries/tools/ToolsPrereqs.h
r5738 r5831 77 77 class ParticleInterface; 78 78 class Shader; 79 template <class T>80 79 class Timer; 81 class StaticTimer;82 80 } 83 81 -
code/branches/core5/src/modules/gamestates/GSRoot.cc
r5829 r5831 103 103 } 104 104 105 for (ObjectList<Timer Base>::iterator it = ObjectList<TimerBase>::begin(); it; )105 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; ) 106 106 (it++)->tick(time); 107 107 -
code/branches/core5/src/modules/overlays/FadeoutText.cc
r5738 r5831 46 46 47 47 this->bFadingOut_ = false; 48 this->fadeouttimer_.setTimer(3.0f, false, this, createExecutor(createFunctor(&FadeoutText::fadeout)));48 this->fadeouttimer_.setTimer(3.0f, false, createExecutor(createFunctor(&FadeoutText::fadeout, this))); 49 49 this->fadeouttimer_.stopTimer(); 50 50 -
code/branches/core5/src/modules/overlays/FadeoutText.h
r5738 r5831 68 68 69 69 bool bFadingOut_; 70 Timer <FadeoutText>fadeouttimer_;70 Timer fadeouttimer_; 71 71 72 72 float initialAlpha_; -
code/branches/core5/src/modules/overlays/hud/ChatOverlay.cc
r5738 r5831 87 87 COUT(0) << "Chat: " << text << std::endl; 88 88 89 new Timer <ChatOverlay>(this->displayTime_, false, this, createExecutor(createFunctor(&ChatOverlay::dropMessage)), true);89 new Timer(this->displayTime_, false, createExecutor(createFunctor(&ChatOverlay::dropMessage, this)), true); 90 90 91 91 this->updateOverlayText(); -
code/branches/core5/src/modules/overlays/hud/UnderAttackHealthBar.cc
r5806 r5831 52 52 this->text_->setPickPoint(Vector2(0.5, 0)); 53 53 54 this->inittimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&UnderAttackHealthBar::init)));54 this->inittimer_.setTimer(0.0f, false, createExecutor(createFunctor(&UnderAttackHealthBar::init, this))); 55 55 } 56 56 -
code/branches/core5/src/modules/overlays/hud/UnderAttackHealthBar.h
r5738 r5831 62 62 PlayerInfo* owner_; 63 63 OverlayText* text_; 64 Timer <UnderAttackHealthBar>inittimer_;64 Timer inittimer_; 65 65 }; 66 66 } -
code/branches/core5/src/modules/pong/Pong.cc
r5806 r5831 52 52 this->setHUDTemplate("PongHUD"); 53 53 54 this->starttimer_.setTimer(1.0, false, this, createExecutor(createFunctor(&Pong::startBall)));54 this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Pong::startBall, this))); 55 55 this->starttimer_.stopTimer(); 56 56 -
code/branches/core5/src/modules/pong/Pong.h
r5738 r5831 62 62 PongBall* ball_; 63 63 PongBat* bat_[2]; 64 Timer <Pong>starttimer_;64 Timer starttimer_; 65 65 }; 66 66 } -
code/branches/core5/src/modules/pong/PongAI.cc
r5800 r5831 60 60 PongAI::~PongAI() 61 61 { 62 for (std::list<std::pair<Timer <PongAI>*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)62 for (std::list<std::pair<Timer*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it) 63 63 (*it).first->destroy(); 64 64 } … … 231 231 232 232 // Add a new Timer 233 Timer <PongAI>* timer = new Timer<PongAI>(delay, false, this, createExecutor(createFunctor(&PongAI::delayedMove)));234 this->reactionTimers_.push_back(std::pair<Timer <PongAI>*, char>(timer, direction));233 Timer* timer = new Timer(delay, false, createExecutor(createFunctor(&PongAI::delayedMove, this))); 234 this->reactionTimers_.push_back(std::pair<Timer*, char>(timer, direction)); 235 235 } 236 236 else … … 246 246 247 247 // Destroy the timer and remove it from the list 248 Timer <PongAI>* timer = this->reactionTimers_.front().first;248 Timer* timer = this->reactionTimers_.front().first; 249 249 timer->destroy(); 250 250 -
code/branches/core5/src/modules/pong/PongAI.h
r5738 r5831 65 65 float strength_; 66 66 67 std::list<std::pair<Timer <PongAI>*, char> > reactionTimers_;67 std::list<std::pair<Timer*, char> > reactionTimers_; 68 68 char movement_; 69 69 char oldMove_; -
code/branches/core5/src/modules/weapons/MuzzleFlash.cc
r5791 r5831 42 42 this->setScale(0.1f); 43 43 44 this->delayTimer_.setTimer(0.1f, false, this, createExecutor(createFunctor(&MuzzleFlash::destroy)));44 this->delayTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&MuzzleFlash::destroy, this))); 45 45 } 46 46 } -
code/branches/core5/src/modules/weapons/MuzzleFlash.h
r5791 r5831 44 44 45 45 private: 46 Timer <MuzzleFlash>delayTimer_;46 Timer delayTimer_; 47 47 }; 48 48 } -
code/branches/core5/src/modules/weapons/munitions/ReplenishingMunition.cc
r5738 r5831 44 44 // replenishIntervall_ and replenishMunitionAmount_ will be set in the constructor of the 45 45 // inheriting class, which comes after this constructor) 46 this->replenishingTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&ReplenishingMunition::initializeTimer)));46 this->replenishingTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&ReplenishingMunition::initializeTimer, this))); 47 47 } 48 48 … … 50 50 { 51 51 // Initialize the timer 52 this->replenishingTimer_.setTimer(this->replenishIntervall_, true, this, createExecutor(createFunctor(&ReplenishingMunition::replenish)));52 this->replenishingTimer_.setTimer(this->replenishIntervall_, true, createExecutor(createFunctor(&ReplenishingMunition::replenish, this))); 53 53 } 54 54 -
code/branches/core5/src/modules/weapons/munitions/ReplenishingMunition.h
r5738 r5831 51 51 void initializeTimer(); 52 52 53 Timer <ReplenishingMunition>replenishingTimer_;53 Timer replenishingTimer_; 54 54 }; 55 55 } -
code/branches/core5/src/modules/weapons/projectiles/LightningGunProjectile.cc
r5738 r5831 42 42 this->textureIndex_ = 1; 43 43 this->maxTextureIndex_ = 8; 44 this->textureTimer_.setTimer(0.01f, true, this, createExecutor(createFunctor(&LightningGunProjectile::changeTexture)));44 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); 45 45 46 46 registerVariables(); -
code/branches/core5/src/modules/weapons/projectiles/LightningGunProjectile.h
r5738 r5831 50 50 unsigned int textureIndex_; 51 51 unsigned int maxTextureIndex_; 52 Timer <LightningGunProjectile>textureTimer_;52 Timer textureTimer_; 53 53 std::string materialBase_; 54 54 private: -
code/branches/core5/src/modules/weapons/projectiles/Projectile.cc
r5800 r5831 61 61 this->attachCollisionShape(shape); 62 62 63 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));63 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Projectile::destroyObject, this))); 64 64 } 65 65 } -
code/branches/core5/src/modules/weapons/projectiles/Projectile.h
r5738 r5831 66 66 float damage_; 67 67 bool bDestroy_; 68 Timer <Projectile>destroyTimer_;68 Timer destroyTimer_; 69 69 }; 70 70 } -
code/branches/core5/src/modules/weapons/weaponmodes/EnergyDrink.cc
r5738 r5831 54 54 this->setMunitionName("FusionMunition"); 55 55 56 this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&EnergyDrink::shot)));56 this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&EnergyDrink::shot, this))); 57 57 this->delayTimer_.stopTimer(); 58 58 } -
code/branches/core5/src/modules/weapons/weaponmodes/EnergyDrink.h
r5738 r5831 59 59 float speed_; 60 60 float delay_; 61 Timer <EnergyDrink>delayTimer_;61 Timer delayTimer_; 62 62 }; 63 63 } -
code/branches/core5/src/modules/weapons/weaponmodes/HsW01.cc
r5738 r5831 54 54 this->setMunitionName("LaserMunition"); 55 55 56 this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&HsW01::shot)));56 this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&HsW01::shot, this))); 57 57 this->delayTimer_.stopTimer(); 58 58 } -
code/branches/core5/src/modules/weapons/weaponmodes/HsW01.h
r5738 r5831 57 57 float speed_; 58 58 float delay_; 59 Timer <HsW01>delayTimer_;59 Timer delayTimer_; 60 60 }; 61 61 } -
code/branches/core5/src/orxonox/controllers/AIController.cc
r5738 r5831 44 44 RegisterObject(AIController); 45 45 46 this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action)));46 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&AIController::action, this))); 47 47 } 48 48 -
code/branches/core5/src/orxonox/controllers/AIController.h
r5738 r5831 50 50 51 51 private: 52 Timer <AIController>actionTimer_;52 Timer actionTimer_; 53 53 }; 54 54 } -
code/branches/core5/src/orxonox/controllers/WaypointPatrolController.cc
r5738 r5831 45 45 this->alertnessradius_ = 500; 46 46 47 this->patrolTimer_.setTimer(rnd(), true, this, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy)));47 this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this))); 48 48 } 49 49 -
code/branches/core5/src/orxonox/controllers/WaypointPatrolController.h
r5738 r5831 61 61 int team_; 62 62 float alertnessradius_; 63 Timer <WaypointPatrolController>patrolTimer_;63 Timer patrolTimer_; 64 64 }; 65 65 } -
code/branches/core5/src/orxonox/gametypes/TeamBaseMatch.cc
r5806 r5831 42 42 RegisterObject(TeamBaseMatch); 43 43 44 this->scoreTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::winPoints)));45 this->outputTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::showPoints)));44 this->scoreTimer_.setTimer(10, true, createExecutor(createFunctor(&TeamBaseMatch::winPoints, this))); 45 this->outputTimer_.setTimer(10, true, createExecutor(createFunctor(&TeamBaseMatch::showPoints, this))); 46 46 47 47 this->pointsTeam1_ = 0; -
code/branches/core5/src/orxonox/gametypes/TeamBaseMatch.h
r5738 r5831 65 65 66 66 std::set<TeamBaseMatchBase*> bases_; 67 Timer <TeamBaseMatch>scoreTimer_;68 Timer <TeamBaseMatch>outputTimer_;67 Timer scoreTimer_; 68 Timer outputTimer_; 69 69 70 70 //points for each team -
code/branches/core5/src/orxonox/graphics/FadingBillboard.cc
r5738 r5831 103 103 { 104 104 this->changedirection_ = 1; 105 this->turnonofftimer_.setTimer(this->turnontime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));105 this->turnonofftimer_.setTimer(this->turnontime_, false, createExecutor(createFunctor(&FadingBillboard::stopturnonoff, this))); 106 106 107 107 if (this->isVisible()) … … 111 111 { 112 112 this->changedirection_ = -1; 113 this->turnonofftimer_.setTimer(this->turnofftime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));113 this->turnonofftimer_.setTimer(this->turnofftime_, false, createExecutor(createFunctor(&FadingBillboard::stopturnonoff, this))); 114 114 } 115 115 } … … 126 126 this->fadedColour_ = ColourValue::ZERO; 127 127 this->getBillboardSet().setColour(this->fadedColour_); 128 this->turnonofftimer_.setTimer(this->postprocessingtime_, false, this, createExecutor(createFunctor(&FadingBillboard::poststopturnonoff)));128 this->turnonofftimer_.setTimer(this->postprocessingtime_, false, createExecutor(createFunctor(&FadingBillboard::poststopturnonoff, this))); 129 129 } 130 130 this->changedirection_ = 0; -
code/branches/core5/src/orxonox/graphics/FadingBillboard.h
r5738 r5831 74 74 float turnofftime_; 75 75 float postprocessingtime_; 76 Timer <FadingBillboard>turnonofftimer_;76 Timer turnonofftimer_; 77 77 char changedirection_; 78 78 ColourValue fadedColour_; -
code/branches/core5/src/orxonox/graphics/ParticleSpawner.cc
r5801 r5831 96 96 return; 97 97 98 this->timer_.setTimer(this->startdelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner)));98 this->timer_.setTimer(this->startdelay_, false, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner, this))); 99 99 } 100 100 … … 103 103 this->setActive(true); 104 104 if (this->lifetime_ != 0) 105 this->timer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner)));105 this->timer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner, this))); 106 106 } 107 107 … … 116 116 117 117 if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_) 118 this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));118 this->timer_.setTimer(this->destroydelay_, false, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner, this))); 119 119 } 120 120 else if (this->bLoop_) 121 121 { 122 this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner)));122 this->timer_.setTimer(this->destroydelay_, false, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner, this))); 123 123 } 124 124 } -
code/branches/core5/src/orxonox/graphics/ParticleSpawner.h
r5791 r5831 89 89 void destroyParticleSpawner(); 90 90 91 Timer <ParticleSpawner>timer_;91 Timer timer_; 92 92 93 93 bool bSuppressStart_; -
code/branches/core5/src/orxonox/pickup/DroppedItem.cc
r5801 r5831 76 76 if (this->timeToLive_ > 0) 77 77 { 78 ExecutorMember<DroppedItem>* exec = createExecutor(createFunctor(&DroppedItem::timerCallback)); 79 this->timer_.setTimer(this->timeToLive_, false, this, exec, false); 78 this->timer_.setTimer(this->timeToLive_, false, createExecutor(createFunctor(&DroppedItem::timerCallback, this)), false); 80 79 } 81 80 } -
code/branches/core5/src/orxonox/pickup/DroppedItem.h
r5738 r5831 77 77 BaseItem* item_; 78 78 79 Timer <DroppedItem>timer_;79 Timer timer_; 80 80 }; 81 81 } -
code/branches/core5/src/orxonox/pickup/ModifierPickup.cc
r5801 r5831 101 101 if (this->duration_ > 0.0f) 102 102 { 103 Executor Member<ModifierPickup>* executor = createExecutor(createFunctor(&ModifierPickup::timerCallback));103 Executor* executor = createExecutor(createFunctor(&ModifierPickup::timerCallback, this)); 104 104 executor->setDefaultValues(pawn); 105 this->timer_.setTimer(this->duration_, false, this,executor);105 this->timer_.setTimer(this->duration_, false, executor); 106 106 } 107 107 -
code/branches/core5/src/orxonox/pickup/ModifierPickup.h
r5738 r5831 129 129 130 130 void timerCallback(Pawn* pawn); //!< Method called when the timer runs out. 131 131 132 private: 132 133 float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType. … … 138 139 std::map<ModifierType::Value, float> multiplicativeModifiers_; //!< Map of multiplicative modifiers, indexed by ModifierType. 139 140 140 float duration_; //!< Duration of this pickup's effect (0 for unlimited).141 Timer <ModifierPickup> timer_;//!< Timer used if the pickup's effect has a time limit.141 float duration_; //!< Duration of this pickup's effect (0 for unlimited). 142 Timer timer_; //!< Timer used if the pickup's effect has a time limit. 142 143 }; 143 144 } -
code/branches/core5/src/orxonox/pickup/PickupSpawner.cc
r5801 r5831 166 166 if (this->respawnTime_ > 0.0f) 167 167 { 168 ExecutorMember<PickupSpawner>* executor = createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback)); 169 this->respawnTimer_.setTimer(this->respawnTime_, false, this, executor); 168 this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this))); 170 169 171 170 this->setActive(false); -
code/branches/core5/src/orxonox/pickup/PickupSpawner.h
r5738 r5831 114 114 115 115 float respawnTime_; //!< Time after which this gets re-actived. 116 Timer <PickupSpawner> respawnTimer_;//!< Timer used for re-activating.116 Timer respawnTimer_; //!< Timer used for re-activating. 117 117 }; 118 118 } -
code/branches/core5/src/orxonox/weaponsystem/Munition.cc
r5738 r5831 461 461 if (bUseReloadTime && (munition->reloadTime_ > 0 || munition->bStackMunition_)) 462 462 { 463 Executor Member<Magazine>* executor = createExecutor(createFunctor(&Magazine::loaded));463 Executor* executor = createExecutor(createFunctor(&Magazine::loaded, this)); 464 464 executor->setDefaultValues(munition); 465 465 466 this->loadTimer_.setTimer(munition->reloadTime_, false, this,executor);466 this->loadTimer_.setTimer(munition->reloadTime_, false, executor); 467 467 } 468 468 else -
code/branches/core5/src/orxonox/weaponsystem/Munition.h
r5738 r5831 47 47 48 48 unsigned int munition_; 49 Timer <Magazine>loadTimer_;49 Timer loadTimer_; 50 50 bool bLoaded_; 51 51 -
code/branches/core5/src/orxonox/weaponsystem/Weapon.cc
r5801 r5831 50 50 this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED; 51 51 52 this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&Weapon::reloaded)));52 this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&Weapon::reloaded, this))); 53 53 this->reloadTimer_.stopTimer(); 54 54 } -
code/branches/core5/src/orxonox/weaponsystem/Weapon.h
r5738 r5831 71 71 std::multimap<unsigned int, WeaponMode*> weaponmodes_; 72 72 73 Timer <Weapon>reloadTimer_;73 Timer reloadTimer_; 74 74 bool bReloading_; 75 75 unsigned int reloadingWeaponmode_; -
code/branches/core5/src/orxonox/weaponsystem/WeaponMode.cc
r5738 r5831 57 57 this->bParallelReload_ = true; 58 58 59 this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&WeaponMode::reloaded)));59 this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this))); 60 60 this->reloadTimer_.stopTimer(); 61 61 -
code/branches/core5/src/orxonox/weaponsystem/WeaponMode.h
r5814 r5831 150 150 std::string munitionname_; 151 151 152 Timer <WeaponMode>reloadTimer_;152 Timer reloadTimer_; 153 153 bool bReloading_; 154 154 }; -
code/branches/core5/src/orxonox/worldentities/BigExplosion.cc
r5801 r5831 90 90 this->setVelocity(velocity); 91 91 92 this->destroyTimer_.setTimer(rnd(2, 4), false, this, createExecutor(createFunctor(&BigExplosion::stop)));92 this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this))); 93 93 } 94 94 this->registerVariables(); … … 329 329 { 330 330 this->bStop_ = true; 331 this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&BigExplosion::destroy)));331 this->destroyTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&BigExplosion::destroy, this))); 332 332 } 333 333 } -
code/branches/core5/src/orxonox/worldentities/BigExplosion.h
r5791 r5831 98 98 99 99 LODParticle::Value LOD_; 100 Timer <BigExplosion>destroyTimer_;100 Timer destroyTimer_; 101 101 }; 102 102 } -
code/branches/core5/src/orxonox/worldentities/ExplosionChunk.cc
r5801 r5831 79 79 this->setVelocity(velocity); 80 80 81 this->destroyTimer_.setTimer(rnd(1, 2), false, this, createExecutor(createFunctor(&ExplosionChunk::stop)));81 this->destroyTimer_.setTimer(rnd(1, 2), false, createExecutor(createFunctor(&ExplosionChunk::stop, this))); 82 82 } 83 83 … … 132 132 { 133 133 this->bStop_ = true; 134 this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&ExplosionChunk::destroy)));134 this->destroyTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&ExplosionChunk::destroy, this))); 135 135 } 136 136 } -
code/branches/core5/src/orxonox/worldentities/ExplosionChunk.h
r5791 r5831 60 60 ParticleInterface* smoke_; 61 61 LODParticle::Value LOD_; 62 Timer <ExplosionChunk>destroyTimer_;62 Timer destroyTimer_; 63 63 }; 64 64 } -
code/branches/core5/src/orxonox/worldentities/MovableEntity.cc
r5801 r5831 98 98 void MovableEntity::clientConnected(unsigned int clientID) 99 99 { 100 this->resynchronizeTimer_.setTimer(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)));100 this->resynchronizeTimer_.setTimer(rnd() * MAX_RESYNCHRONIZE_TIME, false, createExecutor(createFunctor(&MovableEntity::resynchronize, this))); 101 101 } 102 102 … … 110 110 { 111 111 // Resynchronise every few seconds because we only work with velocities (no positions) 112 continuousResynchroTimer_ = new Timer <MovableEntity>(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1),113 true, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), false);112 continuousResynchroTimer_ = new Timer(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1), 113 true, createExecutor(createFunctor(&MovableEntity::resynchronize, this)), false); 114 114 } 115 115 -
code/branches/core5/src/orxonox/worldentities/MovableEntity.h
r5738 r5831 96 96 Quaternion overwrite_orientation_; 97 97 98 Timer <MovableEntity>resynchronizeTimer_;99 Timer <MovableEntity>* continuousResynchroTimer_;98 Timer resynchronizeTimer_; 99 Timer* continuousResynchroTimer_; 100 100 101 101 Pawn* owner_;
Note: See TracChangeset
for help on using the changeset viewer.