diff --git a/core/class_db.h b/core/class_db.h index 0fcef8b8d41..82bcb8da25d 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -170,6 +170,7 @@ public: template static void register_class() { GLOBAL_LOCK_FUNCTION; + static_assert(TypesAreSame::value, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); @@ -182,6 +183,7 @@ public: template static void register_virtual_class() { GLOBAL_LOCK_FUNCTION; + static_assert(TypesAreSame::value, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); @@ -198,6 +200,7 @@ public: template static void register_custom_instance_class() { GLOBAL_LOCK_FUNCTION; + static_assert(TypesAreSame::value, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); diff --git a/core/object.h b/core/object.h index 161cdd456cc..1653d8c3b0d 100644 --- a/core/object.h +++ b/core/object.h @@ -269,6 +269,7 @@ private: friend class ClassDB; \ \ public: \ + typedef m_class self_type; \ virtual String get_class() const { \ return String(#m_class); \ } \ @@ -407,6 +408,8 @@ class ObjectRC; class Object { public: + typedef Object self_type; + enum ConnectFlags { CONNECT_DEFERRED = 1,