From 99ae72c14316957fc2c05943652dd796b38cade5 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Wed, 21 Aug 2024 19:48:10 +0800 Subject: [PATCH] Fix editor properties not being clamped on + and - button click Closed #8778 --- src/game/editor/editor_props.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/editor/editor_props.cpp b/src/game/editor/editor_props.cpp index ca09167bc..34d1e92e9 100644 --- a/src/game/editor/editor_props.cpp +++ b/src/game/editor/editor_props.cpp @@ -50,13 +50,13 @@ SEditResult CEditor::DoPropertiesWithState(CUIRect *pToolBox, CProperty *pPro } if(DoButton_FontIcon((char *)&pIds[i] + 1, FONT_ICON_MINUS, 0, &Dec, 0, "Decrease", IGraphics::CORNER_L, 7.0f)) { - *pNewVal = pProps[i].m_Value - 1; + *pNewVal = clamp(pProps[i].m_Value - 1, pProps[i].m_Min, pProps[i].m_Max); Change = i; State = EEditState::ONE_GO; } if(DoButton_FontIcon(((char *)&pIds[i]) + 2, FONT_ICON_PLUS, 0, &Inc, 0, "Increase", IGraphics::CORNER_R, 7.0f)) { - *pNewVal = pProps[i].m_Value + 1; + *pNewVal = clamp(pProps[i].m_Value + 1, pProps[i].m_Min, pProps[i].m_Max); Change = i; State = EEditState::ONE_GO; }