summaryrefslogtreecommitdiff
path: root/src/client/client.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2022-07-09 22:32:08 +0200
committerGitHub <noreply@github.com>2022-07-09 22:32:08 +0200
commit051181fa6ee00d8379e8a7dc7442b58342d4352b (patch)
tree58ad84f05310024b311c533684defdbeb5ee3e84 /src/client/client.cpp
parent7c261118e06c630ea9ad00f20d7005b8edc108dd (diff)
downloadminetest-051181fa6ee00d8379e8a7dc7442b58342d4352b.tar.gz
minetest-051181fa6ee00d8379e8a7dc7442b58342d4352b.tar.bz2
minetest-051181fa6ee00d8379e8a7dc7442b58342d4352b.zip
Enforce limits of settings that could cause buggy behaviour (#12450)
Enforces the setting value bounds that are currently only limited by the GUI (settingtypes.txt).
Diffstat (limited to 'src/client/client.cpp')
-rw-r--r--src/client/client.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 37d4bd816..0f8297080 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -118,6 +118,7 @@ Client::Client(
m_particle_manager(&m_env),
m_con(new con::Connection(PROTOCOL_ID, 512, CONNECTION_TIMEOUT, ipv6, this)),
m_address_name(address_name),
+ m_allow_login_or_register(allow_login_or_register),
m_server_ser_ver(SER_FMT_VER_INVALID),
m_last_chat_message_sent(time(NULL)),
m_password(password),
@@ -125,8 +126,7 @@ Client::Client(
m_media_downloader(new ClientMediaDownloader()),
m_state(LC_Created),
m_game_ui(game_ui),
- m_modchannel_mgr(new ModChannelMgr()),
- m_allow_login_or_register(allow_login_or_register)
+ m_modchannel_mgr(new ModChannelMgr())
{
// Add local player
m_env.setLocalPlayer(new LocalPlayer(this, playername));
@@ -424,7 +424,7 @@ void Client::step(float dtime)
if(m_map_timer_and_unload_interval.step(dtime, map_timer_and_unload_dtime)) {
std::vector<v3s16> deleted_blocks;
m_env.getMap().timerUpdate(map_timer_and_unload_dtime,
- g_settings->getFloat("client_unload_unused_data_timeout"),
+ std::max(g_settings->getFloat("client_unload_unused_data_timeout"), 0.0f),
g_settings->getS32("client_mapblock_limit"),
&deleted_blocks);
@@ -1254,7 +1254,7 @@ void Client::sendChatMessage(const std::wstring &message)
pkt << message;
Send(&pkt);
- } else if (m_out_chat_queue.size() < (u16) max_queue_size || max_queue_size == -1) {
+ } else if (m_out_chat_queue.size() < (u16) max_queue_size || max_queue_size < 0) {
m_out_chat_queue.push(message);
} else {
infostream << "Could not queue chat message because maximum out chat queue size ("