- internal : refactored RlvHandler::canTouch() for the addition of @touchXXX commands in the RLV-2.4 specification

-> @touchobj and @touchhud are sectioned off by the RLV_EXTENSION_CMD_TOUCHXXX define
    -> @touchworld and @touchattach are now always available

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2011-01-21 01:11:32 +01:00
parent 50215d1448
commit d69a80eea4
2 changed files with 37 additions and 43 deletions

View File

@ -567,6 +567,43 @@ void RlvHandler::onTeleportFinished(const LLVector3d& posArrival)
// String/chat censoring functions
//
// Checked: 2010-01-21 (RLVa-1.3.0e) | Modified: RLVa-1.3.0e
bool RlvHandler::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset /*=LLVector3::zero*/) const
{
const LLUUID& idRoot = (pObj) ? pObj->getRootEdit()->getID() : LLUUID::null;
#ifdef RLV_EXTENSION_CMD_TOUCHXXX
bool fCanTouch = (idRoot.notNull()) &&
((!hasBehaviour(RLV_BHVR_TOUCHOBJ)) || (!isException(RLV_BHVR_TOUCHOBJ, idRoot, RLV_CHECK_PERMISSIVE)));
#else
bool fCanTouch = (idRoot.notNull());
#endif // RLV_EXTENSION_CMD_TOUCHXXX
if (fCanTouch)
{
if ( (!pObj->isAttachment()) || (!pObj->permYouOwner()) )
{
// Rezzed prim or attachment worn by another avie
fCanTouch =
( (!hasBehaviour(RLV_BHVR_TOUCHWORLD)) || (isException(RLV_BHVR_TOUCHWORLD, idRoot, RLV_CHECK_PERMISSIVE)) ) &&
( (!hasBehaviour(RLV_BHVR_FARTOUCH)) ||
(dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= 1.5f * 1.5f) );
}
else if (!pObj->isHUDAttachment())
{
// Regular attachment worn by this avie
fCanTouch = (!hasBehaviour(RLV_BHVR_TOUCHATTACH)) || (isException(RLV_BHVR_TOUCHATTACH, idRoot, RLV_CHECK_PERMISSIVE));
}
#ifdef RLV_EXTENSION_CMD_TOUCHXXX
else
{
// HUD attachment
fCanTouch = (!hasBehaviour(RLV_BHVR_TOUCHHUD)) || (isException(RLV_BHVR_TOUCHHUD, idRoot, RLV_CHECK_PERMISSIVE));
}
#endif // RLV_EXTENSION_CMD_TOUCHXXX
}
return fCanTouch;
}
size_t utf8str_strlen(const std::string& utf8)
{
const char* pUTF8 = utf8.c_str(); size_t length = 0;

View File

@ -273,49 +273,6 @@ inline bool RlvHandler::canTeleportViaLure(const LLUUID& idAgent) const
return ((!hasBehaviour(RLV_BHVR_TPLURE)) || (isException(RLV_BHVR_TPLURE, idAgent))) && (canStand());
}
// Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-1.1.0l
inline bool RlvHandler::canTouch(const LLViewerObject* pObj, const LLVector3& posOffset /*=LLVector3::zero*/) const
{
#ifdef RLV_EXTENSION_CMD_TOUCHXXX
bool fCanTouch = (pObj) &&
( (!hasBehaviour(RLV_BHVR_TOUCHOBJ)) || (!isException(RLV_BHVR_TOUCHOBJ, pObj->getRootEdit()->getID(), RLV_CHECK_PERMISSIVE)) );
if (fCanTouch)
{
if ( (!pObj->isAttachment()) || (!pObj->permYouOwner()) )
{
// Rezzed prim or attachment worn by another avie
fCanTouch =
( (!hasBehaviour(RLV_BHVR_TOUCHWORLD)) ||
(isException(RLV_BHVR_TOUCHWORLD, pObj->getRootEdit()->getID(), RLV_CHECK_PERMISSIVE)) ) &&
( (!hasBehaviour(RLV_BHVR_FARTOUCH)) ||
(dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= 1.5f * 1.5f) );
}
else if (pObj->isHUDAttachment())
{
// HUD attachment
fCanTouch = (!hasBehaviour(RLV_BHVR_TOUCHHUD)) ||
(isException(RLV_BHVR_TOUCHHUD, pObj->getRootEdit()->getID(), RLV_CHECK_PERMISSIVE));
}
else
{
// Regular attachment worn by this avie
fCanTouch =
( (!hasBehaviour(RLV_BHVR_TOUCHATTACH)) ||
(isException(RLV_BHVR_TOUCHATTACH, pObj->getRootEdit()->getID(), RLV_CHECK_PERMISSIVE)) );
}
}
return fCanTouch;
#else
return (pObj) &&
(
((pObj->isAttachment()) && (pObj->permYouOwner())) ||
( (!hasBehaviour(RLV_BHVR_FARTOUCH)) ||
(dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= 1.5f * 1.5f) )
);
#endif // RLV_EXTENSION_CMD_TOUCHXXX
}
inline bool RlvHandler::hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const
{
return hasBehaviourExcept(eBehaviour, strOption, LLUUID::null);