From 5eb20b78778ad0123a8f70c87eccf937d3f34e27 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Thu, 9 Mar 2017 14:52:26 +0200 Subject: [PATCH] Removed Create, CreateOnce, Register, Unregister from the C++ side as well --- src/events.cpp | 85 -------------------------------------------------- 1 file changed, 85 deletions(-) diff --git a/src/events.cpp b/src/events.cpp index 3c30cc1e08..e2ccd87087 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -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); \