From 908f30698596f1da722acf63c681f6dc86ab4d02 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Sat, 19 Jul 2025 19:16:22 -0400 Subject: [PATCH] fix some abs() type conversion warnings --- code/math/ik_solver.cpp | 2 +- code/model/modelread.cpp | 4 ++-- code/physics/physics.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/math/ik_solver.cpp b/code/math/ik_solver.cpp index fa0e62ff4d..a83da4a575 100644 --- a/code/math/ik_solver.cpp +++ b/code/math/ik_solver.cpp @@ -204,7 +204,7 @@ bool ik_constraint_window::constrain(matrix& localRot, bool /*backwardsPass*/) c //Clamp absolute value of individual angles to window for (float angles::* i : pbh) { - const float absAngle = abs(currentAngles.*i); + const float absAngle = std::abs(currentAngles.*i); if(absAngle > absLimit.*i){ needsClamp = true; currentAngles.*i = copysignf(std::min(absAngle, absLimit.*i), currentAngles.*i); diff --git a/code/model/modelread.cpp b/code/model/modelread.cpp index 9aaafc09c0..1e264477b6 100644 --- a/code/model/modelread.cpp +++ b/code/model/modelread.cpp @@ -1065,7 +1065,7 @@ float get_submodel_delta_angle(const submodel_instance *smi) float get_submodel_delta_shift(const submodel_instance *smi) { // this is a bit simpler - return abs(smi->cur_offset - smi->prev_offset); + return std::abs(smi->cur_offset - smi->prev_offset); } void do_new_subsystem( int n_subsystems, model_subsystem *slist, int subobj_num, float rad, const vec3d *pnt, char *props, const char *subobj_name, int model_num ) @@ -4388,7 +4388,7 @@ void submodel_look_at(polymodel *pm, polymodel_instance *pmi, int submodel_num) // calculate turn rate // (try to avoid a one-frame dramatic spike in the turn rate if the angle passes 0.0 or PI2) - if (abs(smi->cur_angle - smi->prev_angle) < PI) + if (std::abs(smi->cur_angle - smi->prev_angle) < PI) smi->current_turn_rate = smi->desired_turn_rate = (smi->cur_angle - smi->prev_angle) / flFrametime; // and now set the other submodel fields diff --git a/code/physics/physics.cpp b/code/physics/physics.cpp index 6ef9e8db76..639313f7ea 100644 --- a/code/physics/physics.cpp +++ b/code/physics/physics.cpp @@ -1249,7 +1249,7 @@ bool physics_lead_ballistic_trajectory(const vec3d* start, const vec3d* end_pos, time = range / (weapon_speed * cosf(angle)); - if (abs(time - best_guess_time) < 0.01f) + if (std::abs(time - best_guess_time) < 0.01f) break; else best_guess_time = time;