- fixed : "Wear" and "Add" aren't grayed out on context menus when @addttach=n restricted

-> RlvAttachmentLocks::canAttach() would return RLV_WEAR and allow the attach
    -> RlvAttachmentLockWatchdog would detach the attachment as soon as it attached due to the @remattach=n

--HG--
branch : RLVa
master
Kitty Barnett 2011-05-22 03:21:14 +02:00
parent 1404e6ea34
commit 78e17b0bf8
2 changed files with 20 additions and 3 deletions

View File

@ -204,6 +204,21 @@ void RlvAttachmentLocks::addAttachmentPointLock(S32 idxAttachPt, const LLUUID& i
m_AttachPtAdd.insert(std::pair<S32, LLUUID>(idxAttachPt, idRlvObj));
}
// Checked: 2011-05-22 (RLVa-1.3.1b) | Added: RLVa-1.3.1b
bool RlvAttachmentLocks::canAttach() const
{
if (isAgentAvatarValid())
{
for (LLVOAvatar::attachment_map_t::const_iterator itAttachPt = gAgentAvatarp->mAttachmentPoints.begin();
itAttachPt != gAgentAvatarp->mAttachmentPoints.end(); ++itAttachPt)
{
if (!isLockedAttachmentPoint(itAttachPt->first, RLV_LOCK_ADD))
return true;
}
}
return false;
}
// Checked: 2010-08-07 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i
bool RlvAttachmentLocks::canDetach(const LLViewerJointAttachment* pAttachPt, bool fDetachAll /*=false*/) const
{

View File

@ -116,6 +116,8 @@ protected:
* canAttach/canDetach trivial helper functions (note that a more approriate name might be userCanAttach/userCanDetach)
*/
public:
// Returns TRUE if there is at least one attachment point that can be attached to
bool canAttach() const;
// Returns TRUE if the inventory item can be attached by the user (and optionally provides the attachment point - which may be NULL)
ERlvWearMask canAttach(const LLInventoryItem* pItem, LLViewerJointAttachment** ppAttachPtOut = NULL) const;
// Returns TRUE if the attachment point can be attached to by the user
@ -430,16 +432,16 @@ inline S32 RlvAttachPtLookup::getAttachPointIndex(const LLViewerObject* pObj)
// RlvAttachmentLocks inlined member functions
//
// Checked: 2011-03-27 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g
// Checked: 2011-05-22 (RLVa-1.3.1b) | Modified: RLVa-1.3.1b
inline ERlvWearMask RlvAttachmentLocks::canAttach(const LLInventoryItem* pItem, LLViewerJointAttachment** ppAttachPtOut /*=NULL*/) const
{
// The specified item can be attached if:
// - it doesn't specify an attachment point
// - it doesn't specify an attachment point and there is at least one attachment point that can be attached to
// - the attachment point it specifies can be attached to
LLViewerJointAttachment* pAttachPt = RlvAttachPtLookup::getAttachPoint(pItem);
if (ppAttachPtOut)
*ppAttachPtOut = pAttachPt;
return ((pItem) && (!RlvFolderLocks::instance().isLockedFolder(pItem->getParentUUID(), RLV_LOCK_ADD)))
return ((canAttach()) && (pItem) && (!RlvFolderLocks::instance().isLockedFolder(pItem->getParentUUID(), RLV_LOCK_ADD)))
? ((!pAttachPt) ? RLV_WEAR : canAttach(pAttachPt)) : RLV_WEAR_LOCKED;
}