summaryrefslogtreecommitdiff
path: root/src/client/hud.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2018-04-03 23:05:22 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2018-04-03 23:05:22 +0200
commit05fe3b06c80fc7fa438ed5faf5805c79a92789e9 (patch)
tree160ec2fa0bb26cedcdfeb2e330ba1d41107dd158 /src/client/hud.cpp
parent4827f754ec9efc1e1fa8e519eaa211ed768e25c0 (diff)
downloadminetest-05fe3b06c80fc7fa438ed5faf5805c79a92789e9.tar.gz
minetest-05fe3b06c80fc7fa438ed5faf5805c79a92789e9.tar.bz2
minetest-05fe3b06c80fc7fa438ed5faf5805c79a92789e9.zip
Fix last clang-tidy reported problems for performance-type-promotion-in-math-fn
Based on https://travis-ci.org/minetest/minetest/jobs/361810382 output Also fix 2 missing copyright notices
Diffstat (limited to 'src/client/hud.cpp')
-rw-r--r--src/client/hud.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/hud.cpp b/src/client/hud.cpp
index 5137c2f3e..fffe85e1d 100644
--- a/src/client/hud.cpp
+++ b/src/client/hud.cpp
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "client/hud.h"
+#include <cmath>
#include "settings.h"
#include "util/numeric.h"
#include "log.h"
@@ -50,7 +51,7 @@ Hud::Hud(gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player,
this->inventory = inventory;
m_hud_scaling = g_settings->getFloat("hud_scaling");
- m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE *
+ m_hotbar_imagesize = std::floor(HOTBAR_IMAGE_SIZE *
RenderingEngine::getDisplayDensity() + 0.5f);
m_hotbar_imagesize *= m_hud_scaling;
m_padding = m_hotbar_imagesize / 12;
@@ -336,7 +337,8 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
case HUD_ELEM_WAYPOINT: {
v3f p_pos = player->getPosition() / BS;
v3f w_pos = e->world_pos * BS;
- float distance = floor(10 * p_pos.getDistanceFrom(e->world_pos)) / 10;
+ float distance = std::floor(10 * p_pos.getDistanceFrom(e->world_pos)) /
+ 10.0f;
scene::ICameraSceneNode* camera =
RenderingEngine::get_scene_manager()->getActiveCamera();
w_pos -= intToFloat(camera_offset, BS);
@@ -735,12 +737,12 @@ void drawItemStack(video::IVideoDriver *driver,
// wear = 0.5: yellow
// wear = 1.0: red
video::SColor color(255,255,255,255);
- int wear_i = MYMIN(floor(wear * 600), 511);
+ int wear_i = MYMIN(std::floor(wear * 600), 511);
wear_i = MYMIN(wear_i + 10, 511);
- if(wear_i <= 255)
+ if (wear_i <= 255)
color.set(255, wear_i, 255, 0);
else
- color.set(255, 255, 511-wear_i, 0);
+ color.set(255, 255, 511 - wear_i, 0);
core::rect<s32> progressrect2 = progressrect;
progressrect2.LowerRightCorner.X = progressmid;