mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +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:
parent
7c261118e0
commit
051181fa6e
28 changed files with 74 additions and 56 deletions
|
@ -76,9 +76,9 @@ GUIChatConsole::GUIChatConsole(
|
|||
m_background_color.setBlue(clamp_u8(myround(console_color.Z)));
|
||||
}
|
||||
|
||||
u16 chat_font_size = g_settings->getU16("chat_font_size");
|
||||
const u16 chat_font_size = g_settings->getU16("chat_font_size");
|
||||
m_font = g_fontengine->getFont(chat_font_size != 0 ?
|
||||
chat_font_size : FONT_SIZE_UNSPECIFIED, FM_Mono);
|
||||
rangelim(chat_font_size, 5, 72) : FONT_SIZE_UNSPECIFIED, FM_Mono);
|
||||
|
||||
if (!m_font) {
|
||||
errorstream << "GUIChatConsole: Unable to load mono font" << std::endl;
|
||||
|
|
|
@ -3212,8 +3212,8 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
|||
offset = v2s32(0,0);
|
||||
}
|
||||
|
||||
double gui_scaling = g_settings->getFloat("gui_scaling");
|
||||
double screen_dpi = RenderingEngine::getDisplayDensity() * 96;
|
||||
const double gui_scaling = g_settings->getFloat("gui_scaling", 0.5f, 42.0f);
|
||||
const double screen_dpi = RenderingEngine::getDisplayDensity() * 96;
|
||||
|
||||
double use_imgsize;
|
||||
if (m_lock) {
|
||||
|
|
|
@ -84,7 +84,7 @@ GUITable::GUITable(gui::IGUIEnvironment *env,
|
|||
#endif
|
||||
core::rect<s32> relative_rect = m_scrollbar->getRelativePosition();
|
||||
s32 width = (relative_rect.getWidth() / (2.0 / 3.0)) * density *
|
||||
g_settings->getFloat("gui_scaling");
|
||||
g_settings->getFloat("gui_scaling", 0.5f, 20.0f);
|
||||
m_scrollbar->setRelativePosition(core::rect<s32>(
|
||||
relative_rect.LowerRightCorner.X-width,relative_rect.UpperLeftCorner.Y,
|
||||
relative_rect.LowerRightCorner.X,relative_rect.LowerRightCorner.Y
|
||||
|
|
|
@ -40,7 +40,7 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
|
|||
m_menumgr(menumgr),
|
||||
m_remap_dbl_click(remap_dbl_click)
|
||||
{
|
||||
m_gui_scale = g_settings->getFloat("gui_scaling");
|
||||
m_gui_scale = std::max(g_settings->getFloat("gui_scaling"), 0.5f);
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
float d = RenderingEngine::getDisplayDensity();
|
||||
m_gui_scale *= 1.1 - 0.3 * d + 0.2 * d * d;
|
||||
|
|
|
@ -843,7 +843,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
|
|||
s32 dy = Y - m_pointerpos[event.TouchInput.ID].Y;
|
||||
|
||||
// adapt to similar behaviour as pc screen
|
||||
double d = g_settings->getFloat("mouse_sensitivity") * 3.0f;
|
||||
const double d = g_settings->getFloat("mouse_sensitivity", 0.001f, 10.0f) * 3.0f;
|
||||
|
||||
m_camera_yaw_change -= dx * d;
|
||||
m_camera_pitch = MYMIN(MYMAX(m_camera_pitch + (dy * d), -180), 180);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue