From 58d8368481813398aab77717a59461c3b79e3a2d Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Thu, 23 Mar 2023 15:59:41 +0100 Subject: Fix collide_shape return type Fix PhysicsDirectSpaceState3D::_collide_shape return type. Also PhysicsDirectSpaceState2D::_collide_shape. (cherry picked from commit 61429a5f49f2509f631703886b8b3234701a0206) --- servers/physics_server_2d.cpp | 8 ++++---- servers/physics_server_2d.h | 2 +- servers/physics_server_3d.cpp | 8 ++++---- servers/physics_server_3d.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'servers') diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index f9a8d5f156..4ad83ef327 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -409,17 +409,17 @@ Vector PhysicsDirectSpaceState2D::_cast_motion(const Ref PhysicsDirectSpaceState2D::_collide_shape(const Ref &p_shape_query, int p_max_results) { - ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array()); +TypedArray PhysicsDirectSpaceState2D::_collide_shape(const Ref &p_shape_query, int p_max_results) { + ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray()); Vector ret; ret.resize(p_max_results * 2); int rc = 0; bool res = collide_shape(p_shape_query->get_parameters(), ret.ptrw(), p_max_results, rc); if (!res) { - return TypedArray(); + return TypedArray(); } - TypedArray r; + TypedArray r; r.resize(rc * 2); for (int i = 0; i < rc * 2; i++) { r[i] = ret[i]; diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h index 3e254e610e..56ec94ba9f 100644 --- a/servers/physics_server_2d.h +++ b/servers/physics_server_2d.h @@ -120,7 +120,7 @@ class PhysicsDirectSpaceState2D : public Object { TypedArray _intersect_point(const Ref &p_point_query, int p_max_results = 32); TypedArray _intersect_shape(const Ref &p_shape_query, int p_max_results = 32); Vector _cast_motion(const Ref &p_shape_query); - TypedArray _collide_shape(const Ref &p_shape_query, int p_max_results = 32); + TypedArray _collide_shape(const Ref &p_shape_query, int p_max_results = 32); Dictionary _get_rest_info(const Ref &p_shape_query); protected: diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index c9cf8f99af..9495ce2262 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -429,17 +429,17 @@ Vector PhysicsDirectSpaceState3D::_cast_motion(const Ref PhysicsDirectSpaceState3D::_collide_shape(const Ref &p_shape_query, int p_max_results) { - ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array()); +TypedArray PhysicsDirectSpaceState3D::_collide_shape(const Ref &p_shape_query, int p_max_results) { + ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray()); Vector ret; ret.resize(p_max_results * 2); int rc = 0; bool res = collide_shape(p_shape_query->get_parameters(), ret.ptrw(), p_max_results, rc); if (!res) { - return TypedArray(); + return TypedArray(); } - TypedArray r; + TypedArray r; r.resize(rc * 2); for (int i = 0; i < rc * 2; i++) { r[i] = ret[i]; diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h index 2c7ebeea66..0275aee818 100644 --- a/servers/physics_server_3d.h +++ b/servers/physics_server_3d.h @@ -125,7 +125,7 @@ private: TypedArray _intersect_point(const Ref &p_point_query, int p_max_results = 32); TypedArray _intersect_shape(const Ref &p_shape_query, int p_max_results = 32); Vector _cast_motion(const Ref &p_shape_query); - TypedArray _collide_shape(const Ref &p_shape_query, int p_max_results = 32); + TypedArray _collide_shape(const Ref &p_shape_query, int p_max_results = 32); Dictionary _get_rest_info(const Ref &p_shape_query); protected: -- cgit v1.2.3