1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Fix some minor code issues all over the place

This commit is contained in:
sfan5 2020-12-23 22:03:49 +01:00
parent 289425f6bd
commit 74762470b2
19 changed files with 45 additions and 109 deletions

View file

@ -1165,7 +1165,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
}
}
if (!getParent() && std::fabs(m_prop.automatic_rotate) > 0.001) {
if (!getParent() && node && fabs(m_prop.automatic_rotate) > 0.001f) {
// This is the child node's rotation. It is only used for automatic_rotate.
v3f local_rot = node->getRotation();
local_rot.Y = modulo360f(local_rot.Y - dtime * core::RADTODEG *
@ -1174,7 +1174,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
}
if (!getParent() && m_prop.automatic_face_movement_dir &&
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) {
(fabs(m_velocity.Z) > 0.001f || fabs(m_velocity.X) > 0.001f)) {
float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
+ m_prop.automatic_face_movement_dir_offset;
float max_rotation_per_sec =