Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5309 in orxonox.OLD


Ignore:
Timestamp:
Oct 8, 2005, 12:47:00 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Ckeck if an Event is already subscribed via isSubscribed, and using it in the ShellInput

Location:
trunk/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/event/event_handler.h

    r5237 r5309  
    3535  void unsubscribe(EventListener* el, elState state = ES_ALL);
    3636  void flush(elState state);
     37  /** @returns true, if the @param state has @param eventType subscribed?? */
     38  inline bool isSubscribed(elState state, int eventType) { return(listeners[state][eventType] == NULL)?false:true; };
    3739
    3840  void process();
  • trunk/src/lib/shell/shell_input.cc

    r5306 r5309  
    5858  EventHandler* evh = EventHandler::getInstance();
    5959  for (int i = 1; i < SDLK_LAST; i++)
    60     evh->subscribe(this, ES_SHELL, i);
    61 
     60  {
     61    if (!evh->isSubscribed(ES_SHELL, i))
     62      evh->subscribe(this, ES_SHELL, i);
     63  }
    6264  this->completion = new ShellCompletion(this);
    6365}
Note: See TracChangeset for help on using the changeset viewer.