aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
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/script/lua_api
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/script/lua_api')
-rw-r--r--src/script/lua_api/l_camera.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/script/lua_api/l_camera.cpp b/src/script/lua_api/l_camera.cpp
index 49622df00..326cc6d53 100644
--- a/src/script/lua_api/l_camera.cpp
+++ b/src/script/lua_api/l_camera.cpp
@@ -1,5 +1,25 @@
-#include "script/common/c_converter.h"
+/*
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
#include "l_camera.h"
+#include <cmath>
+#include "script/common/c_converter.h"
#include "l_internal.h"
#include "content_cao.h"
#include "camera.h"
@@ -98,7 +118,8 @@ int LuaCamera::l_get_look_dir(lua_State *L)
float pitch = -1.0 * player->getPitch() * core::DEGTORAD;
float yaw = (player->getYaw() + 90.) * core::DEGTORAD;
- v3f v(cos(pitch) * cos(yaw), sin(pitch), cos(pitch) * sin(yaw));
+ v3f v(std::cos(pitch) * std::cos(yaw), std::sin(pitch),
+ std::cos(pitch) * std::sin(yaw));
push_v3f(L, v);
return 1;