Event Manager cannot register types

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Event Manager cannot register types

      I can't see how I can ever use the event manager for things other the the wildcard type.

      All the functions check if a type is valid, and the validator rejects unknown types:

      Looking at the code it doesn't make sense and it fails in practice in a project.

      What am I missing?

      Source Code

      1. bool EventManager::VAddListener(EventListenerPtr const & inListener, EventType const & inType)
      2. {
      3. if (!VValidateType( inType ))
      4. return false;
      5. ...
      6. }
      7. bool EventManager::VValidateType( EventType const & inType) const {
      8. ...
      9. EventTypeSet::const_iterator evIt=m_typeList.find(inType);
      10. if (evIt==m_typeList.end()){
      11. assert(...);
      12. return false;
      13. }
      14. }
      Display All
    • There are indeed 3 functions for registering event types. You might just have missed it. Look at the EventManagerImpl.h and EventManagerImpl.cpp files in the EventManager folder:

      // Registers an event type for the particular usage desired.
      // ...for an event defined in script:
      void RegisterScriptEvent( const EventType & eventType );

      // ...for an event defined by code, *NOT* callable by script.
      void RegisterCodeOnlyEvent( const EventType & eventType );

      // ...for an event defined by code, but callable by script. REQUIRES the event type to have a constructor taking a LuaObject.
      template< class T> void RegisterEvent( const EventType & eventType );