1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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).
This commit is contained in:
SmallJoker 2022-07-09 22:32:08 +02:00 committed by GitHub
parent 7c261118e0
commit 051181fa6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 74 additions and 56 deletions

View file

@ -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 ("