Changeset 5895 for code/branches/core5/src/modules/overlays/hud
- Timestamp:
- Oct 6, 2009, 9:42:58 PM (15 years ago)
- Location:
- code/branches/core5/src/modules/overlays/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/modules/overlays/hud/ChatOverlay.cc
r5831 r5895 58 58 ChatOverlay::~ChatOverlay() 59 59 { 60 for (std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it) 61 delete (*it); 60 62 } 61 63 … … 87 89 COUT(0) << "Chat: " << text << std::endl; 88 90 89 new Timer(this->displayTime_, false, createExecutor(createFunctor(&ChatOverlay::dropMessage, this)), true); 91 Timer* timer = new Timer(); 92 this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor 93 Executor* executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this)); 94 executor->setDefaultValues(timer); 95 timer->setTimer(this->displayTime_, false, executor, true); 90 96 91 97 this->updateOverlayText(); 92 98 } 93 99 94 void ChatOverlay::dropMessage( )100 void ChatOverlay::dropMessage(Timer* timer) 95 101 { 96 102 if (this->messages_.size() > 0) 97 103 this->messages_.pop_front(); 98 104 this->updateOverlayText(); 105 this->timers_.erase(timer); // the timer destroys itself, but we have to remove it from the set 99 106 } 100 107 -
code/branches/core5/src/modules/overlays/hud/ChatOverlay.h
r5738 r5895 55 55 private: 56 56 void updateOverlayText(); 57 void dropMessage( );57 void dropMessage(Timer* timer); 58 58 59 59 float displayTime_; 60 std::set<Timer*> timers_; 60 61 }; 61 62 }
Note: See TracChangeset
for help on using the changeset viewer.