22 #ifndef ULTIMA_SHARED_CORE_MESSAGE_TARGET_H 23 #define ULTIMA_SHARED_CORE_MESSAGE_TARGET_H 25 #include "ultima/shared/core/base_object.h" 33 typedef bool (MessageTarget:: *PMSG)(CMessage *msg);
41 const MSGMAP *(*pFnGetBaseMap)();
45 #define DECLARE_MESSAGE_MAP \ 47 static const Ultima::Shared::MSGMAP *getThisMessageMap(); \ 48 const Ultima::Shared::MSGMAP *getMessageMap() const override 50 #define DECLARE_MESSAGE_MAP_BASE \ 52 static const Ultima::Shared::MSGMAP *getThisMessageMap(); \ 53 virtual const Ultima::Shared::MSGMAP *getMessageMap() const 55 #define BEGIN_MESSAGE_MAP(theClass, baseClass) \ 56 Ultima::Shared::ClassDef theClass::type() { return Ultima::Shared::ClassDef(#theClass, &baseClass::type); } \ 57 const Ultima::Shared::MSGMAP *theClass::getMessageMap() const \ 58 { return getThisMessageMap(); } \ 59 const Ultima::Shared::MSGMAP *theClass::getThisMessageMap() \ 61 typedef theClass ThisClass; \ 62 typedef baseClass TheBaseClass; \ 63 typedef bool (theClass::*FNPTR)(Ultima::Shared::CMessage *msg); \ 64 static const Ultima::Shared::MSGMAP_ENTRY _messageEntries[] = { 66 #define ON_MESSAGE(msgClass) \ 67 { static_cast<Ultima::Shared::PMSG>((FNPTR)&ThisClass::msgClass), &C##msgClass::type }, 69 #define END_MESSAGE_MAP() \ 70 { (Ultima::Shared::PMSG)nullptr, nullptr } \ 72 static const Ultima::Shared::MSGMAP messageMap = \ 73 { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ 77 #define EMPTY_MESSAGE_MAP(theClass, baseClass) \ 78 Ultima::Shared::ClassDef theClass::type() { return Ultima::Shared::ClassDef(#theClass, &baseClass::type); } \ 79 const Ultima::Shared::MSGMAP *theClass::getMessageMap() const \ 80 { return getThisMessageMap(); } \ 81 const Ultima::Shared::MSGMAP *theClass::getThisMessageMap() \ 83 typedef baseClass TheBaseClass; \ 84 static const Ultima::Shared::MSGMAP_ENTRY _messageEntries[] = { \ 85 { (Ultima::Shared::PMSG)nullptr, nullptr } \ 87 static const Ultima::Shared::MSGMAP messageMap = \ 88 { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ 91 enum { DUMMY##theClass } 98 DECLARE_MESSAGE_MAP_BASE;
Definition: message_target.h:97
Definition: message_target.h:35
Definition: message_target.h:40
Definition: detection.h:27
Definition: base_object.h:71