From 1d66744377909cbe133ffa35d2dd8cd7638010a1 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 20 Jun 2021 13:21:52 +0500 Subject: [PATCH] Use fabs for float. --- dlls/zx/bot.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/zx/bot.cpp b/dlls/zx/bot.cpp index 83c53ad8..ab741b36 100644 --- a/dlls/zx/bot.cpp +++ b/dlls/zx/bot.cpp @@ -582,7 +582,7 @@ float CBot::BotChangeYaw( float speed ) ideal = pev->ideal_yaw; // find the difference in the current and ideal angle - diff = abs(current - ideal); + diff = fabs(current - ideal); // check if the bot is already facing the ideal_yaw direction... if (diff <= 1) @@ -1326,10 +1326,10 @@ void CBot::BotTurnAtWall( TraceResult *tr ) // D1 and D2 are the difference (in degrees) between the bot's current // angle and Y1 or Y2 (respectively). - D1 = abs(Y - Y1); - if (D1 > 179) D1 = abs(D1 - 360); - D2 = abs(Y - Y2); - if (D2 > 179) D2 = abs(D2 - 360); + D1 = fabs(Y - Y1); + if (D1 > 179) D1 = fabs(D1 - 360); + D2 = fabs(Y - Y2); + if (D2 > 179) D2 = fabs(D2 - 360); // If difference 1 (D1) is more than difference 2 (D2) then the bot will // have to turn LESS if it heads in direction Y1 otherwise, head in