From a143da5f5209249f0596a0344694b3e5025e7298 Mon Sep 17 00:00:00 2001 From: Erik Bolumburu <108585396+erikbolumburu11@users.noreply.github.com> Date: Thu, 29 Jun 2023 22:36:44 +0100 Subject: [PATCH] Added assert messages to Vector3 functions --- include/SFML/System/Vector3.inl | 6 +++--- src/SFML/System/Vector3.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/SFML/System/Vector3.inl b/include/SFML/System/Vector3.inl index 69671540..9387ed4b 100644 --- a/include/SFML/System/Vector3.inl +++ b/include/SFML/System/Vector3.inl @@ -89,9 +89,9 @@ constexpr Vector3 Vector3::cwiseMul(const Vector3& rhs) const template constexpr Vector3 Vector3::cwiseDiv(const Vector3& rhs) const { - assert(rhs.x != 0); - assert(rhs.y != 0); - assert(rhs.z != 0); + assert(rhs.x != 0 && "Vector3::cwiseDiv() cannot divide by 0"); + assert(rhs.y != 0 && "Vector3::cwiseDiv() cannot divide by 0"); + assert(rhs.z != 0 && "Vector3::cwiseDiv() cannot divide by 0"); return Vector3(x / rhs.x, y / rhs.y, z / rhs.z); } diff --git a/src/SFML/System/Vector3.cpp b/src/SFML/System/Vector3.cpp index 313539fc..0d563aef 100644 --- a/src/SFML/System/Vector3.cpp +++ b/src/SFML/System/Vector3.cpp @@ -38,7 +38,7 @@ Vector3 Vector3::normalized() const { static_assert(std::is_floating_point_v, "Vector3::normalized() is only supported for floating point types"); - assert(*this != Vector3()); + assert(*this != Vector3() && "Vector3::normalized() cannot normalize a zero vector"); return (*this) / length(); }