Skip to content

Commit eed4643

Browse files
fix some abs() type conversion warnings
1 parent 7b5d1bc commit eed4643

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

code/math/ik_solver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ bool ik_constraint_window::constrain(matrix& localRot, bool /*backwardsPass*/) c
204204

205205
//Clamp absolute value of individual angles to window
206206
for (float angles::* i : pbh) {
207-
const float absAngle = abs(currentAngles.*i);
207+
const float absAngle = std::abs(currentAngles.*i);
208208
if(absAngle > absLimit.*i){
209209
needsClamp = true;
210210
currentAngles.*i = copysignf(std::min(absAngle, absLimit.*i), currentAngles.*i);

code/model/modelread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ float get_submodel_delta_angle(const submodel_instance *smi)
10651065
float get_submodel_delta_shift(const submodel_instance *smi)
10661066
{
10671067
// this is a bit simpler
1068-
return abs(smi->cur_offset - smi->prev_offset);
1068+
return std::abs(smi->cur_offset - smi->prev_offset);
10691069
}
10701070

10711071
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)
43884388

43894389
// calculate turn rate
43904390
// (try to avoid a one-frame dramatic spike in the turn rate if the angle passes 0.0 or PI2)
4391-
if (abs(smi->cur_angle - smi->prev_angle) < PI)
4391+
if (std::abs(smi->cur_angle - smi->prev_angle) < PI)
43924392
smi->current_turn_rate = smi->desired_turn_rate = (smi->cur_angle - smi->prev_angle) / flFrametime;
43934393

43944394
// and now set the other submodel fields

code/physics/physics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ bool physics_lead_ballistic_trajectory(const vec3d* start, const vec3d* end_pos,
12421242

12431243
time = range / (weapon_speed * cosf(angle));
12441244

1245-
if (abs(time - best_guess_time) < 0.01f)
1245+
if (std::abs(time - best_guess_time) < 0.01f)
12461246
break;
12471247
else
12481248
best_guess_time = time;

0 commit comments

Comments
 (0)