summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-02-25 23:49:41 -0800
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-02-25 23:49:41 -0800
commit3b4e4f8bc98832ac5fdd211dbf4a611e24c076a6 (patch)
tree8d442a6c9b467f144e7feb9eab58bdcec409c6ed /indra/newview
parent460a58bfc4eea07b5cdcb6192a955cb180fb9297 (diff)
PATH-341: BUGFIX Clamping the walkability coefficient text inputs to maximum value.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.cpp19
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.h2
-rw-r--r--indra/newview/llpathfindinglinkset.h6
3 files changed, 24 insertions, 3 deletions
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp
index ad021c4286..11eae2386a 100644
--- a/indra/newview/llfloaterpathfindinglinksets.cpp
+++ b/indra/newview/llfloaterpathfindinglinksets.cpp
@@ -141,6 +141,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild()
mEditA = findChild<LLLineEditor>("edit_a_value");
llassert(mEditA != NULL);
mEditA->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditA->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1));
mLabelEditB = findChild<LLTextBase>("edit_b_label");
llassert(mLabelEditB != NULL);
@@ -148,6 +149,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild()
mEditB = findChild<LLLineEditor>("edit_b_value");
llassert(mEditB != NULL);
mEditB->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditB->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1));
mLabelEditC = findChild<LLTextBase>("edit_c_label");
llassert(mLabelEditC != NULL);
@@ -155,6 +157,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild()
mEditC = findChild<LLLineEditor>("edit_c_value");
llassert(mEditC != NULL);
mEditC->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditC->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1));
mLabelEditD = findChild<LLTextBase>("edit_d_label");
llassert(mLabelEditD != NULL);
@@ -162,6 +165,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild()
mEditD = findChild<LLLineEditor>("edit_d_value");
llassert(mEditD != NULL);
mEditD->setPrevalidate(LLTextValidate::validateNonNegativeS32);
+ mEditD->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered, this, _1));
mApplyEditsButton = findChild<LLButton>("apply_edit_values");
llassert(mApplyEditsButton != NULL);
@@ -496,6 +500,21 @@ void LLFloaterPathfindingLinksets::onTeleportClicked()
}
}
+void LLFloaterPathfindingLinksets::onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl)
+{
+ LLLineEditor *pLineEditor = static_cast<LLLineEditor *>(pUICtrl);
+ llassert(pLineEditor != NULL);
+
+ const std::string &valueString = pLineEditor->getText();
+ S32 value = static_cast<S32>(atoi(valueString.c_str()));
+
+ if ((value < LLPathfindingLinkset::MIN_WALKABILITY_VALUE) || (value > LLPathfindingLinkset::MAX_WALKABILITY_VALUE))
+ {
+ value = llclamp(value, LLPathfindingLinkset::MIN_WALKABILITY_VALUE, LLPathfindingLinkset::MAX_WALKABILITY_VALUE);
+ pLineEditor->setValue(LLSD(value));
+ }
+}
+
void LLFloaterPathfindingLinksets::onApplyChangesClicked()
{
applyEdit();
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h
index 83c74c8530..1d26c00cd3 100644
--- a/indra/newview/llfloaterpathfindinglinksets.h
+++ b/indra/newview/llfloaterpathfindinglinksets.h
@@ -36,6 +36,7 @@
#include "llpathfindingmanager.h"
class LLSD;
+class LLUICtrl;
class LLTextBase;
class LLScrollListCtrl;
class LLLineEditor;
@@ -126,6 +127,7 @@ private:
void onReturnClicked();
void onDeleteClicked();
void onTeleportClicked();
+ void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl);
void onApplyChangesClicked();
void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState);
diff --git a/indra/newview/llpathfindinglinkset.h b/indra/newview/llpathfindinglinkset.h
index 3f9217fa3c..590fcd3f1a 100644
--- a/indra/newview/llpathfindinglinkset.h
+++ b/indra/newview/llpathfindinglinkset.h
@@ -76,6 +76,9 @@ public:
LLSD encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
+ static const S32 MIN_WALKABILITY_VALUE;
+ static const S32 MAX_WALKABILITY_VALUE;
+
protected:
private:
@@ -86,9 +89,6 @@ private:
static BOOL isPermanent(ELinksetUse pLinksetUse);
static BOOL isWalkable(ELinksetUse pLinksetUse);
- static const S32 MIN_WALKABILITY_VALUE;
- static const S32 MAX_WALKABILITY_VALUE;
-
LLUUID mUUID;
bool mIsTerrain;
std::string mName;