Merge pull request #1046 from dsnopek/revert-fix-object-cast-to

Revert "Fix Object::cast_to<T>() for custom classes"
pull/1033/merge
Rémi Verschelde 2023-02-20 10:09:53 +01:00 committed by GitHub
commit 2f07eb07ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -142,7 +142,7 @@ T *Object::cast_to(Object *p_object) {
if (casted == nullptr) { if (casted == nullptr) {
return nullptr; return nullptr;
} }
return dynamic_cast<T *>((Object *)internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks)); return reinterpret_cast<T *>(internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
} }
template <class T> template <class T>
@ -155,7 +155,7 @@ const T *Object::cast_to(const Object *p_object) {
if (casted == nullptr) { if (casted == nullptr) {
return nullptr; return nullptr;
} }
return dynamic_cast<const T *>((Object *)internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks)); return reinterpret_cast<const T *>(internal::gde_interface->object_get_instance_binding(casted, internal::token, &T::___binding_callbacks));
} }
} // namespace godot } // namespace godot