aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2021-09-27 17:45:44 +0200
committerGitHub <noreply@github.com>2021-09-27 17:45:44 +0200
commitd51d0f3a5a60679436bf7d4e1980f3a82f229848 (patch)
treee6d15df599dd04df76b8493a4cdcaf6b550c4cce /src/client
parent918fbe3ec1667c65a320f1f6b432449f104d8e26 (diff)
downloadminetest-d51d0f3a5a60679436bf7d4e1980f3a82f229848.tar.gz
minetest-d51d0f3a5a60679436bf7d4e1980f3a82f229848.tar.bz2
minetest-d51d0f3a5a60679436bf7d4e1980f3a82f229848.zip
Various code improvements
* Camera: Fix division by 0 after view bobbing * Remove ignored constness * Connection: Improve window size range limits
Diffstat (limited to 'src/client')
-rw-r--r--src/client/camera.cpp3
-rw-r--r--src/client/client.h8
-rw-r--r--src/client/gameui.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/client/camera.cpp b/src/client/camera.cpp
index 2629a6359..48e60c433 100644
--- a/src/client/camera.cpp
+++ b/src/client/camera.cpp
@@ -378,7 +378,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
// Smoothen and invert the above
fall_bobbing = sin(fall_bobbing * 0.5 * M_PI) * -1;
// Amplify according to the intensity of the impact
- fall_bobbing *= (1 - rangelim(50 / player->camera_impact, 0, 1)) * 5;
+ if (player->camera_impact > 0.0f)
+ fall_bobbing *= (1 - rangelim(50 / player->camera_impact, 0, 1)) * 5;
fall_bobbing *= m_cache_fall_bobbing_amount;
}
diff --git a/src/client/client.h b/src/client/client.h
index b0324ee90..b92b456f4 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -334,13 +334,13 @@ public:
// disconnect client when CSM failed.
const std::string &accessDeniedReason() const { return m_access_denied_reason; }
- const bool itemdefReceived() const
+ bool itemdefReceived() const
{ return m_itemdef_received; }
- const bool nodedefReceived() const
+ bool nodedefReceived() const
{ return m_nodedef_received; }
- const bool mediaReceived() const
+ bool mediaReceived() const
{ return !m_media_downloader; }
- const bool activeObjectsReceived() const
+ bool activeObjectsReceived() const
{ return m_activeobjects_received; }
u16 getProtoVersion()
diff --git a/src/client/gameui.h b/src/client/gameui.h
index 2eb2488e6..3f31f1b57 100644
--- a/src/client/gameui.h
+++ b/src/client/gameui.h
@@ -84,7 +84,7 @@ public:
void showTranslatedStatusText(const char *str);
inline void clearStatusText() { m_statustext.clear(); }
- const bool isChatVisible()
+ bool isChatVisible()
{
return m_flags.show_chat && m_recent_chat_count != 0 && m_profiler_current_page == 0;
}