Removed Create, CreateOnce, Register, Unregister from the C++ side as well

This commit is contained in:
ZZYZX 2017-03-09 14:52:26 +02:00 committed by Christoph Oelckers
parent 01561eb768
commit 5eb20b7877

View file

@ -552,38 +552,6 @@ DEFINE_ACTION_FUNCTION(DEventHandler, SendNetworkEvent)
ACTION_RETURN_BOOL(E_SendNetworkEvent(name, arg1, arg2, arg3, false));
}
DEFINE_ACTION_FUNCTION(DEventHandler, Create)
{
PARAM_PROLOGUE;
PARAM_CLASS(t, DStaticEventHandler);
// check if type inherits dynamic handlers
if (E_IsStaticType(t))
{
// disallow static types creation with Create()
ACTION_RETURN_OBJECT(nullptr);
}
// generate a new object of this type.
ACTION_RETURN_OBJECT(t->CreateNew());
}
DEFINE_ACTION_FUNCTION(DEventHandler, CreateOnce)
{
PARAM_PROLOGUE;
PARAM_CLASS(t, DStaticEventHandler);
// check if type inherits dynamic handlers
if (E_IsStaticType(t))
{
// disallow static types creation with Create()
ACTION_RETURN_OBJECT(nullptr);
}
// check if there are already registered handlers of this type.
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
if (handler->GetClass() == t) // check precise class
ACTION_RETURN_OBJECT(handler);
// generate a new object of this type.
ACTION_RETURN_OBJECT(t->CreateNew());
}
DEFINE_ACTION_FUNCTION(DEventHandler, Find)
{
PARAM_PROLOGUE;
@ -594,45 +562,6 @@ DEFINE_ACTION_FUNCTION(DEventHandler, Find)
ACTION_RETURN_OBJECT(nullptr);
}
DEFINE_ACTION_FUNCTION(DEventHandler, Register)
{
PARAM_PROLOGUE;
PARAM_OBJECT(handler, DStaticEventHandler);
if (handler->IsStatic()) ACTION_RETURN_BOOL(false);
ACTION_RETURN_BOOL(E_RegisterHandler(handler));
}
DEFINE_ACTION_FUNCTION(DEventHandler, Unregister)
{
PARAM_PROLOGUE;
PARAM_OBJECT(handler, DStaticEventHandler);
if (handler->IsStatic()) ACTION_RETURN_BOOL(false);
ACTION_RETURN_BOOL(E_UnregisterHandler(handler));
}
// for static
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Create)
{
PARAM_PROLOGUE;
PARAM_CLASS(t, DStaticEventHandler);
// static handlers can create any type of object.
// generate a new object of this type.
ACTION_RETURN_OBJECT(t->CreateNew());
}
DEFINE_ACTION_FUNCTION(DStaticEventHandler, CreateOnce)
{
PARAM_PROLOGUE;
PARAM_CLASS(t, DStaticEventHandler);
// static handlers can create any type of object.
// check if there are already registered handlers of this type.
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
if (handler->GetClass() == t) // check precise class
ACTION_RETURN_OBJECT(handler);
// generate a new object of this type.
ACTION_RETURN_OBJECT(t->CreateNew());
}
// we might later want to change this
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Find)
{
@ -644,20 +573,6 @@ DEFINE_ACTION_FUNCTION(DStaticEventHandler, Find)
ACTION_RETURN_OBJECT(nullptr);
}
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Register)
{
PARAM_PROLOGUE;
PARAM_OBJECT(handler, DStaticEventHandler);
ACTION_RETURN_BOOL(E_RegisterHandler(handler));
}
DEFINE_ACTION_FUNCTION(DStaticEventHandler, Unregister)
{
PARAM_PROLOGUE;
PARAM_OBJECT(handler, DStaticEventHandler);
ACTION_RETURN_BOOL(E_UnregisterHandler(handler));
}
#define DEFINE_EMPTY_HANDLER(cls, funcname) DEFINE_ACTION_FUNCTION(cls, funcname) \
{ \
PARAM_SELF_PROLOGUE(cls); \