Skip to content
Snippets Groups Projects
Commit 56c4028e authored by Kitty Barnett's avatar Kitty Barnett
Browse files

[FIXED] Exclusion ranges for @recvim and @sendim are calculated wrong

--HG--
branch : RLVa
parent 38d10433
No related branches found
No related tags found
No related merge requests found
...@@ -132,12 +132,20 @@ bool RlvActions::canChangeActiveGroup(const LLUUID& idRlvObject) ...@@ -132,12 +132,20 @@ bool RlvActions::canChangeActiveGroup(const LLUUID& idRlvObject)
// Little helper function to check the IM exclusion range for @recvim, @sendim and @startim (returns: min_dist <= (pos user - pos target) <= max_dist) // Little helper function to check the IM exclusion range for @recvim, @sendim and @startim (returns: min_dist <= (pos user - pos target) <= max_dist)
static bool rlvCheckAvatarIMDistance(const LLUUID& idAvatar, ERlvBehaviourModifier eModDistMin, ERlvBehaviourModifier eModDistMax) static bool rlvCheckAvatarIMDistance(const LLUUID& idAvatar, ERlvBehaviourModifier eModDistMin, ERlvBehaviourModifier eModDistMax)
{ {
LLVector3d posAgent; // | no limits | minimum set | min+max set | !fHasMin | !fHasMax = INF | fHasMax
// -------------------------------------------------------------- ------------------------------------
// dist <= min <= max | block | block | block | F | F | F
// min <= dist <= max | block | allow | allow | F | T | T
// min <= max <= dist | block | allow | block | F | ^ (see above) | F
// off-region | block | allow | block | F | ^ (see above) | F
const RlvBehaviourModifier *pBhvrModDistMin = RlvBehaviourDictionary::instance().getModifier(eModDistMin), *pBhvrModDistMax = RlvBehaviourDictionary::instance().getModifier(eModDistMax); const RlvBehaviourModifier *pBhvrModDistMin = RlvBehaviourDictionary::instance().getModifier(eModDistMin), *pBhvrModDistMax = RlvBehaviourDictionary::instance().getModifier(eModDistMax);
if ( ((pBhvrModDistMin->hasValue()) || (pBhvrModDistMax->hasValue())) && (LLWorld::getInstance()->getAvatar(idAvatar, posAgent)) ) if (pBhvrModDistMin->hasValue())
{ {
float nDist = llabs(dist_vec_squared(gAgent.getPositionGlobal(), posAgent)); LLVector3d posAgent; bool fHasMax = pBhvrModDistMax->hasValue();
return (nDist >= pBhvrModDistMin->getValue<float>()) && (nDist <= pBhvrModDistMax->getValue<float>()); float nMinDist = pBhvrModDistMin->getValue<float>(), nMaxDist = (fHasMax) ? pBhvrModDistMax->getValue<float>() : std::numeric_limits<float>::max();
float nDist = (LLWorld::getInstance()->getAvatar(idAvatar, posAgent)) ? llabs(dist_vec_squared(gAgent.getPositionGlobal(), posAgent)) : std::numeric_limits<float>::max();
return (nMinDist < nMaxDist) && (nMinDist <= nDist) && (nDist <= nMaxDist);
} }
return false; return false;
} }
......
...@@ -87,7 +87,6 @@ public: ...@@ -87,7 +87,6 @@ public:
*/ */
static bool canChangeActiveGroup(const LLUUID& idRlvObject = LLUUID::null); static bool canChangeActiveGroup(const LLUUID& idRlvObject = LLUUID::null);
/* /*
* Returns true if the user is allowed to receive IMs from the specified sender (can be an avatar or a group) * Returns true if the user is allowed to receive IMs from the specified sender (can be an avatar or a group)
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment