From e51c3c256d6315a60af19697f68fb12c463365e4 Mon Sep 17 00:00:00 2001 From: Mestima Date: Sat, 14 May 2022 14:47:19 +0300 Subject: [PATCH] Create method was removed because it's useless --- hook.cpp | 8 +------- hook.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/hook.cpp b/hook.cpp index 1d9b601..dbb9cad 100644 --- a/hook.cpp +++ b/hook.cpp @@ -6,13 +6,8 @@ Dictionary Hook::GetTable() { return table; } -void Hook::Create(String name) { - Dictionary newHook = Dictionary(); - table[name] = newHook; -} - void Hook::Add(String event, String uid, Ref function) { - Dictionary tmp = table[event]; + Dictionary tmp = table.get(event, Dictionary()); tmp[uid] = function; table[event] = tmp; } @@ -47,7 +42,6 @@ void Hook::Remove(String event, String uid) { void Hook::_bind_methods() { ClassDB::bind_method(D_METHOD("GetTable"), &Hook::GetTable); - ClassDB::bind_method(D_METHOD("Create", "name"), &Hook::Create); ClassDB::bind_method(D_METHOD("Add", "event", "uid", "function"), &Hook::Add); ClassDB::bind_method(D_METHOD("Call", "event", "args"), &Hook::Call); ClassDB::bind_method(D_METHOD("Remove", "event", "uid"), &Hook::Remove); diff --git a/hook.h b/hook.h index 89edd40..fe8ca30 100644 --- a/hook.h +++ b/hook.h @@ -19,7 +19,6 @@ protected: public: Dictionary GetTable(); - void Create(String name); void Add(String event, String uid, Ref function); void Call(String event, Array args); void Remove(String event, String uid);