Changeset 11052 for code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
- Timestamp:
- Jan 9, 2016, 6:26:20 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
r10624 r11052 86 86 } 87 87 88 Dynamicmatch::~Dynamicmatch() 89 { 90 for (std::set<Timer*>::iterator it = this->piggyTimers_.begin(); it != this->piggyTimers_.end(); ++it) 91 delete (*it); 92 } 93 88 94 void Dynamicmatch::setConfigValues() 89 95 { … … 312 318 spaceship->addSpeedFactor(5); 313 319 ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this)); 314 executor->setDefaultValue(0, spaceship); 315 new Timer(10, false, executor, true); 320 Timer* timer = new Timer(10, false, executor); 321 executor->setDefaultValue(0, spaceship); // TODO: use WeakPtr because spaceship can be destroyed in the meantime 322 executor->setDefaultValue(1, timer); 323 this->piggyTimers_.insert(timer); 316 324 } 317 325 } … … 590 598 } 591 599 592 void Dynamicmatch::resetSpeedFactor(SpaceShip* spaceship )// helper function600 void Dynamicmatch::resetSpeedFactor(SpaceShip* spaceship, Timer* timer)// helper function 593 601 { 594 602 if (spaceship) … … 596 604 spaceship->addSpeedFactor(1.0f/5.0f); 597 605 } 606 607 this->piggyTimers_.erase(timer); 608 delete timer; 598 609 } 599 610
Note: See TracChangeset
for help on using the changeset viewer.