Moved empty virtual methods to script side

This commit is contained in:
ZZYZX 2017-01-30 11:56:03 +02:00
parent 2382a76be5
commit 5751f84350
2 changed files with 19 additions and 25 deletions

View file

@ -368,17 +368,10 @@ DEFINE_ACTION_FUNCTION(DStaticEventHandler, Unregister)
ACTION_RETURN_BOOL(E_UnregisterHandler(handler)); ACTION_RETURN_BOOL(E_UnregisterHandler(handler));
} }
#define DEFINE_EVENT_HANDLER(cls, funcname, args) DEFINE_ACTION_FUNCTION(cls, funcname) \ #define DEFINE_EVENT_HANDLER(cls, funcname, args) void cls::funcname(args) \
{ \
PARAM_SELF_PROLOGUE(cls); \
return 0; \
} \
void cls::funcname(args) \
{ \ { \
IFVIRTUAL(cls, funcname) \ IFVIRTUAL(cls, funcname) \
{ \ { \
if (func == cls##_##funcname##_VMPtr) \
return; \
VMValue params[1] = { (cls*)this }; \ VMValue params[1] = { (cls*)this }; \
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr); \ GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr); \
} \ } \

View file

@ -9,11 +9,12 @@ class StaticEventHandler : Object native
protected static native bool Register(StaticEventHandler handler); protected static native bool Register(StaticEventHandler handler);
protected static native bool Unregister(StaticEventHandler handler); protected static native bool Unregister(StaticEventHandler handler);
virtual native void WorldLoaded(); // world stuff
virtual native void WorldUnloaded(); virtual void WorldLoaded() {}
virtual native void WorldThingSpawned(); virtual void WorldUnloaded() {}
virtual void WorldThingSpawned() {}
virtual native void RenderFrame(); // render stuff
virtual void RenderFrame() {}
} }
class StaticRenderEventHandler : StaticEventHandler native class StaticRenderEventHandler : StaticEventHandler native