// Checked: 2009-10-12 (RLVa-1.0.5b) | Modified: RLVa-1.0.5b void RlvAttachmentManager::onWearAttachment(const LLUUID& idItem) { // We only need to keep track of wears if there are non-attachable attachment points if (!gRlvHandler.hasLockedAttachment(RLV_LOCK_ADD)) return; LLVOAvatar* pAvatar = gAgent.getAvatarObject(); if (!pAvatar) return; // If the attachment point this will end up being attached to is: // - unlocked : nothing should happen (from RLVa's point of view) // - RLV_LOCK_ADD: the new attachment should get detached and the current one reattached (unless it's currently empty) // - RLV_LOCK_REM: the current attachment will get reattached on ObjectKill (if there is no current one then nothing should happen) RlvWearInfo infoWear(idItem); for (LLVOAvatar::attachment_map_t::const_iterator itAttach = pAvatar->mAttachmentPoints.begin(); itAttach != pAvatar->mAttachmentPoints.end(); ++itAttach) { if (gRlvHandler.isLockedAttachment(itAttach->first, RLV_LOCK_ADD)) // We only need to keep track of these (see above) infoWear.attachPts.insert(std::pair<S32, LLUUID>(itAttach->first, itAttach->second->getItemID())); } m_PendingWear.insert(std::pair<LLUUID, RlvWearInfo>(idItem, infoWear)); startTimer(); }
// Checked: 2010-07-28 (RLVa-1.1.3a) | Modified: RLVa-1.2.0i void RlvAttachmentLockWatchdog::onWearAttachment(const LLUUID& idItem, ERlvWearMask eWearAction) { // We only need to keep track of user wears if there's actually anything locked RLV_ASSERT(idItem.notNull()); LLVOAvatar* pAvatar = gAgent.getAvatarObject(); if ( (idItem.isNull()) || (!pAvatar) || (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) ) return; // If the attachment point this will end up being attached to is: // - unlocked : nothing should happen (from RLVa's point of view) // - RLV_LOCK_ADD: the new attachment should get detached and the current one(s) reattached (unless it's currently empty) // - RLV_LOCK_REM: // o eWearAction == RLV_WEAR_ADD : nothing should happen (from RLVa's point of view) // o eWearAction == RLV_WEAR_REPLACE : examine whether the new attachment can indeed replace/detach the old one RlvWearInfo infoWear(idItem, eWearAction); RLV_ASSERT( (RLV_WEAR_ADD == eWearAction) || (RLV_WEAR_REPLACE == eWearAction) ); // One of the two, but never both for (LLVOAvatar::attachment_map_t::const_iterator itAttachPt = pAvatar->mAttachmentPoints.begin(); itAttachPt != pAvatar->mAttachmentPoints.end(); ++itAttachPt) { const LLViewerJointAttachment* pAttachPt = itAttachPt->second; // We only need to know which attachments were present for RLV_LOCK_ADD locked attachment points (and not RLV_LOCK_REM locked ones) if (gRlvAttachmentLocks.isLockedAttachmentPoint(pAttachPt, RLV_LOCK_ADD)) { uuid_vec_t attachObjs; for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin(); itAttachObj != pAttachPt->mAttachedObjects.end(); ++itAttachObj) { const LLViewerObject* pAttachObj = *itAttachObj; if (std::find(m_PendingDetach.begin(), m_PendingDetach.end(), pAttachObj->getAttachmentItemID()) != m_PendingDetach.end()) continue; // Exclude attachments that are pending a force-detach attachObjs.push_back(pAttachObj->getAttachmentItemID()); } infoWear.attachPts.insert(std::pair<S32, uuid_vec_t>(itAttachPt->first, attachObjs)); } } m_PendingWear.insert(std::pair<LLUUID, RlvWearInfo>(idItem, infoWear)); #ifdef RLV_DEBUG infoWear.dumpInstance(); #endif // RLV_RELEASE startTimer(); }