Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 29, 2010, 1:16:16 PM (14 years ago)
Author:
dafrick
Message:

Created a new class of triggers called Multitriggers.
MultiTriggers are triggers which (as opposed to normal triggers) have a state for each object triggering the MultiTrigger, that means, that a MultiTrigger can be triggered for two different Players, while not being triggered for a third.
To go with this MultiTrigger I created a data structure (MultitriggerContainer), which helps relaying important information to the objects, that receive the Events of the trigger.
Also there is a MultiDistanceTrigger, which is just the DistanceTrigger as a MultiTrigger.

To make this work I had to make some adjustements to the eventsystem, namely an EventState can now be either an EventState (as it was before) or an EventSink, which means that every efent arriving at the EventState is processed as opposed to just the ones which change the state.
There is a new makro (XMLPortEventSink) to create an EventState with sink behaviour. It can be used exacly as the XMLPortEventState makro.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/EventIncludes.h

    r6417 r6800  
    5252    } \
    5353    XMLPortEventStateIntern(xmlportevent##function, classname, statename, xmlelement, mode)
     54   
     55#define XMLPortEventSink(classname, subclassname, statename, function, xmlelement, mode) \
     56    orxonox::EventState* containername##function = this->getEventState(statename); \
     57    if (!containername##function) \
     58    { \
     59        containername##function = new orxonox::EventState(orxonox::createFunctor(&classname::function, this), orxonox::ClassIdentifier<subclassname>::getIdentifier(), true); \
     60        this->addEventState(statename, containername##function); \
     61    } \
     62    XMLPortEventStateIntern(xmlportevent##function, classname, statename, xmlelement, mode)
    5463
    5564/**
    56     @brief Like XMLPortEventState but with additional template arguments to identify the function of the state (if ambiguous).
     65    @brief Like XMLPortEventState but creates an event sink instead of an event state.
     66           The most important destinction between an EventState and an EventSink is, that an EventState only processes event which change the state of the EventState, where as an EventSink is an EventState that processes any Event that reaches it.
    5767*/
    5868#define XMLPortEventStateTemplate(classname, subclassname, statename, function, xmlelement, mode, ...) \
Note: See TracChangeset for help on using the changeset viewer.