Merge pull request #30576 from qarmin/lgtm_coverage
Changed some code reported by LGTM and Coverity
This commit is contained in:
commit
d15cf7b672
55 changed files with 94 additions and 202 deletions
|
|
@ -543,16 +543,6 @@ void CapsuleShapeSW::project_range(const Vector3 &p_normal, const Transform &p_t
|
|||
|
||||
r_max = p_normal.dot(p_transform.xform(n));
|
||||
r_min = p_normal.dot(p_transform.xform(-n));
|
||||
return;
|
||||
|
||||
n = p_transform.basis.xform(n);
|
||||
|
||||
real_t distance = p_normal.dot(p_transform.origin);
|
||||
real_t length = Math::abs(p_normal.dot(n));
|
||||
r_min = distance - length;
|
||||
r_max = distance + length;
|
||||
|
||||
ERR_FAIL_COND(r_max < r_min);
|
||||
}
|
||||
|
||||
Vector3 CapsuleShapeSW::get_support(const Vector3 &p_normal) const {
|
||||
|
|
|
|||
|
|
@ -313,10 +313,12 @@ public:
|
|||
if (best_axis == Vector2(0.0, 0.0))
|
||||
return;
|
||||
|
||||
callback->collided = true;
|
||||
if (callback) {
|
||||
callback->collided = true;
|
||||
|
||||
if (!callback->callback)
|
||||
return; //only collide, no callback
|
||||
if (!callback->callback)
|
||||
return; //only collide, no callback
|
||||
}
|
||||
static const int max_supports = 2;
|
||||
|
||||
Vector2 supports_A[max_supports];
|
||||
|
|
@ -354,12 +356,13 @@ public:
|
|||
supports_B[i] += best_axis * margin_B;
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback->normal = best_axis;
|
||||
_generate_contacts_from_supports(supports_A, support_count_A, supports_B, support_count_B, callback);
|
||||
|
||||
callback->normal = best_axis;
|
||||
_generate_contacts_from_supports(supports_A, support_count_A, supports_B, support_count_B, callback);
|
||||
|
||||
if (callback && callback->sep_axis && *callback->sep_axis != Vector2())
|
||||
*callback->sep_axis = Vector2(); //invalidate previous axis (no test)
|
||||
if (callback->sep_axis && *callback->sep_axis != Vector2())
|
||||
*callback->sep_axis = Vector2(); //invalidate previous axis (no test)
|
||||
}
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ SeparatorAxisTest2D(const ShapeA *p_shape_A, const Transform2D &p_transform_a, const ShapeB *p_shape_B, const Transform2D &p_transform_b, _CollectorCallback2D *p_collector, const Vector2 &p_motion_A = Vector2(), const Vector2 &p_motion_B = Vector2(), real_t p_margin_A = 0, real_t p_margin_B = 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue