Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 13, 2009, 5:05:17 PM (15 years ago)
Author:
dafrick
Message:

Hopefully merged trunk successfully into pickup branch.

Location:
code/branches/pickup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup

  • code/branches/pickup/src/modules/objects/eventsystem/EventDispatcher.cc

    r5781 r5935  
    3232#include "core/EventIncludes.h"
    3333#include "core/XMLPort.h"
    34 #include "EventTarget.h"
    3534
    3635namespace orxonox
     
    4645    {
    4746        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();
    5049    }
    5150
     
    5453        SUPER(EventDispatcher, XMLPort, xmlelement, mode);
    5554
    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));
    5759    }
    5860
    5961    void EventDispatcher::processEvent(Event& event)
    6062    {
    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);
    6365    }
    6466
    65     void EventDispatcher::addTarget(EventTarget* target)
     67    void EventDispatcher::addTarget(BaseObject* target)
    6668    {
    6769        this->targets_.push_back(target);
    6870    }
    6971
    70     EventTarget* EventDispatcher::getTarget(unsigned int index) const
     72    BaseObject* EventDispatcher::getTarget(unsigned int index) const
    7173    {
    7274        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)
    7476        {
    7577            if (i == index)
Note: See TracChangeset for help on using the changeset viewer.