diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index c9543988a6..1b8045d837 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -33,7 +33,9 @@ #include "llviewerinventory.h" #include "llviewerregion.h" #include "message.h" - +// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) +#include "rlvhandler.h" +// [/RLVa:KB] LLAttachmentsMgr::LLAttachmentsMgr() { @@ -45,12 +47,18 @@ LLAttachmentsMgr::~LLAttachmentsMgr() void LLAttachmentsMgr::addAttachment(const LLUUID& item_id, const U8 attachment_pt, - const BOOL add) +// const BOOL add) +// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + const BOOL add, const BOOL fRlvForce /*= FALSE*/) +// [/RLVa:KB] { AttachmentsInfo attachment; attachment.mItemID = item_id; attachment.mAttachmentPt = attachment_pt; attachment.mAdd = add; +// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + attachment.mRlvForce = fRlvForce; +// [/RLVa:KB] mPendingAttachments.push_back(attachment); } @@ -62,6 +70,29 @@ void LLAttachmentsMgr::onIdle(void *) void LLAttachmentsMgr::onIdle() { +// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) ) + { + attachments_vec_t::iterator itPending = mPendingAttachments.begin(); + while (itPending != mPendingAttachments.end()) + { + AttachmentsInfo& infoAttachment = *itPending; + const LLInventoryItem* pItem = gInventory.getItem(infoAttachment.mItemID); + if (!infoAttachment.mRlvForce) + { + if (!gRlvAttachmentLocks.canAttach(pItem)) + { + itPending = mPendingAttachments.erase(itPending); + continue; + } + RlvAttachmentLockWatchdog::instance().onWearAttachment(pItem, (infoAttachment.mAdd) ? RLV_WEAR_ADD : RLV_WEAR_REPLACE); + infoAttachment.mAdd = true; + } + ++itPending; + } + } +// [/RLVa:KB] + S32 obj_count = mPendingAttachments.size(); if (obj_count == 0) { diff --git a/indra/newview/llattachmentsmgr.h b/indra/newview/llattachmentsmgr.h index 1d8ab74dfd..69734b6c6c 100644 --- a/indra/newview/llattachmentsmgr.h +++ b/indra/newview/llattachmentsmgr.h @@ -54,7 +54,10 @@ public: void addAttachment(const LLUUID& item_id, const U8 attachment_pt, - const BOOL add); +// const BOOL add); +// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + const BOOL add, const BOOL fRlvForce = FALSE); +// [/RLVa:KB] static void onIdle(void *); protected: void onIdle(); @@ -64,6 +67,9 @@ private: LLUUID mItemID; U8 mAttachmentPt; BOOL mAdd; +// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + BOOL mRlvForce; +// [/RLVa:KB] }; typedef std::vector attachments_vec_t; diff --git a/indra/newview/rlvlocks.cpp b/indra/newview/rlvlocks.cpp index 6001a92645..d6b333b2d0 100644 --- a/indra/newview/rlvlocks.cpp +++ b/indra/newview/rlvlocks.cpp @@ -16,7 +16,9 @@ #include "llviewerprecompiledheaders.h" #include "llnotifications.h" +#include "lltooldraganddrop.h" #include "llviewerobjectlist.h" +#include "llviewerregion.h" #include "pipeline.h" #include "rlvhelper.h" @@ -408,15 +410,26 @@ bool RlvAttachmentLocks::verifyAttachmentLocks() // RlvAttachmentLockWatchdog member functions // -// Checked: 2010-07-28 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i -void RlvAttachmentLockWatchdog::attach(S32 idxAttachPt, const LLUUID& idItem) +// Checked: 2010-09-15 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c +void RlvAttachmentLockWatchdog::attach(const LLUUID& idItem, S32 idxAttachPt) { - // RELEASE-RLVa: [SL-2.0.0] This will need rewriting for "ENABLE_MULTIATTACHMENTS" - LLSD payload; - payload["item_id"] = idItem; - payload["attachment_point"] = idxAttachPt | ATTACHMENT_ADD; - payload["rlv_force"] = true; - LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0); + const LLViewerInventoryItem* pItem = gInventory.getItem(idItem); + if (!pItem) + return; + + LLMessageSystem* pMsg = gMessageSystem; + pMsg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv); + pMsg->nextBlockFast(_PREHASH_AgentData); + pMsg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + pMsg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + pMsg->nextBlockFast(_PREHASH_ObjectData); + pMsg->addUUIDFast(_PREHASH_ItemID, pItem->getUUID()); + pMsg->addUUIDFast(_PREHASH_OwnerID, pItem->getPermissions().getOwner()); + pMsg->addU8Fast(_PREHASH_AttachmentPt, idxAttachPt | ATTACHMENT_ADD); + pack_permissions_slam(pMsg, pItem->getFlags(), pItem->getPermissions()); + pMsg->addStringFast(_PREHASH_Name, pItem->getName()); + pMsg->addStringFast(_PREHASH_Description, pItem->getDescription()); + pMsg->sendReliable(gAgent.getRegion()->getHost()); } // Checked: 2010-07-28 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i @@ -651,7 +664,7 @@ void RlvAttachmentLockWatchdog::onSavedAssetIntoInventory(const LLUUID& idItem) { if ( (!itAttach->second.fAssetSaved) && (idItem == itAttach->second.idItem) ) { - attach(itAttach->first, itAttach->second.idItem); + attach(itAttach->second.idItem, itAttach->first); itAttach->second.tsAttach = LLFrameTimer::getElapsedSeconds(); } } @@ -699,7 +712,7 @@ BOOL RlvAttachmentLockWatchdog::onTimer() if (fAttach) { - attach(itAttach->first, itAttach->second.idItem); + attach(itAttach->second.idItem, itAttach->first); itAttach->second.tsAttach = tsCurrent; } diff --git a/indra/newview/rlvlocks.h b/indra/newview/rlvlocks.h index 76bef63339..ecfe596a03 100644 --- a/indra/newview/rlvlocks.h +++ b/indra/newview/rlvlocks.h @@ -153,7 +153,7 @@ protected: */ protected: // NOTE: attach/detach do *not* respect attachment locks so use with care - void attach(S32 idxAttachPt, const LLUUID& idItem); + void attach(const LLUUID& idItem, S32 idxAttachPt); void detach(const LLViewerObject* pAttachObj); void detach(S32 idxAttachPt, const LLViewerObject* pAttachObjExcept = NULL);