- Timestamp:
- Oct 13, 2009, 5:05:17 PM (15 years ago)
- Location:
- code/branches/pickup
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup
- Property svn:mergeinfo changed
-
code/branches/pickup/src/modules/objects/eventsystem/EventDispatcher.cc
r5781 r5935 32 32 #include "core/EventIncludes.h" 33 33 #include "core/XMLPort.h" 34 #include "EventTarget.h"35 34 36 35 namespace orxonox … … 46 45 { 47 46 if (this->isInitialized()) 48 for (std::list< EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)49 delete (*it);47 for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it) 48 (*it)->destroy(); 50 49 } 51 50 … … 54 53 SUPER(EventDispatcher, XMLPort, xmlelement, mode); 55 54 56 XMLPortObject(EventDispatcher, EventTarget, "targets", addTarget, getTarget, xmlelement, mode); 55 XMLPortObject(EventDispatcher, BaseObject, "targets", addTarget, getTarget, xmlelement, mode); 56 57 // since we need event sources mapped to any state, we have to parse XML by ourselves 58 this->loadAllEventStates(xmlelement, mode, this, Class(EventDispatcher)); 57 59 } 58 60 59 61 void EventDispatcher::processEvent(Event& event) 60 62 { 61 for (std::list< EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)62 (*it)-> fireEvent(event);63 for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it) 64 (*it)->processEvent(event); 63 65 } 64 66 65 void EventDispatcher::addTarget( EventTarget* target)67 void EventDispatcher::addTarget(BaseObject* target) 66 68 { 67 69 this->targets_.push_back(target); 68 70 } 69 71 70 EventTarget* EventDispatcher::getTarget(unsigned int index) const72 BaseObject* EventDispatcher::getTarget(unsigned int index) const 71 73 { 72 74 unsigned int i = 0; 73 for (std::list< EventTarget*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)75 for (std::list<BaseObject*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it) 74 76 { 75 77 if (i == index)
Note: See TracChangeset
for help on using the changeset viewer.