summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/core
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-02-11 17:16:59 -0600
committerDavid Snopek <dsnopek@gmail.com>2023-02-11 17:16:59 -0600
commit75af9003dc2b1583966ab91be6ce1687378860ae (patch)
tree4d59ba888ee255a323001f2bd8c49e0e1700bb2a /include/godot_cpp/core
parent516fad14e45d341211121832bb3daa172aebd6e1 (diff)
downloadredot-cpp-75af9003dc2b1583966ab91be6ce1687378860ae.tar.gz
Fix Object::cast_to<T>() for custom classes
Diffstat (limited to 'include/godot_cpp/core')
-rw-r--r--include/godot_cpp/core/object.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/godot_cpp/core/object.hpp b/include/godot_cpp/core/object.hpp
index f5c790a..a2fa96e 100644
--- a/include/godot_cpp/core/object.hpp
+++ b/include/godot_cpp/core/object.hpp
@@ -142,7 +142,7 @@ T *Object::cast_to(Object *p_object) {
if (casted == nullptr) {
return nullptr;
}
- return reinterpret_cast<T *>(internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
+ return dynamic_cast<T *>((Object *)internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
}
template <class T>
@@ -155,7 +155,7 @@ const T *Object::cast_to(const Object *p_object) {
if (casted == nullptr) {
return nullptr;
}
- return reinterpret_cast<const T *>(internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
+ return dynamic_cast<const T *>((Object *)internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
}
} // namespace godot