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

- internal : moved code from confirm_attachment_rez() to LLAttachmentsMgr class

- internal : RlvAttachmentLockWatchdog::attach() uses RezSingleAttachmentFromInv directly
    -> check whether http://jira.secondlife.com/browse/SVC-5383 is still an issue

--HG--
branch : RLVa
parent f7ff27e3
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#include "llviewerinventory.h" #include "llviewerinventory.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "message.h" #include "message.h"
// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c)
#include "rlvhandler.h"
// [/RLVa:KB]
LLAttachmentsMgr::LLAttachmentsMgr() LLAttachmentsMgr::LLAttachmentsMgr()
{ {
...@@ -45,12 +47,18 @@ LLAttachmentsMgr::~LLAttachmentsMgr() ...@@ -45,12 +47,18 @@ LLAttachmentsMgr::~LLAttachmentsMgr()
void LLAttachmentsMgr::addAttachment(const LLUUID& item_id, void LLAttachmentsMgr::addAttachment(const LLUUID& item_id,
const U8 attachment_pt, 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; AttachmentsInfo attachment;
attachment.mItemID = item_id; attachment.mItemID = item_id;
attachment.mAttachmentPt = attachment_pt; attachment.mAttachmentPt = attachment_pt;
attachment.mAdd = add; 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); mPendingAttachments.push_back(attachment);
} }
...@@ -62,6 +70,29 @@ void LLAttachmentsMgr::onIdle(void *) ...@@ -62,6 +70,29 @@ void LLAttachmentsMgr::onIdle(void *)
void LLAttachmentsMgr::onIdle() 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(); S32 obj_count = mPendingAttachments.size();
if (obj_count == 0) if (obj_count == 0)
{ {
......
...@@ -54,7 +54,10 @@ public: ...@@ -54,7 +54,10 @@ public:
void addAttachment(const LLUUID& item_id, void addAttachment(const LLUUID& item_id,
const U8 attachment_pt, 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 *); static void onIdle(void *);
protected: protected:
void onIdle(); void onIdle();
...@@ -64,6 +67,9 @@ private: ...@@ -64,6 +67,9 @@ private:
LLUUID mItemID; LLUUID mItemID;
U8 mAttachmentPt; U8 mAttachmentPt;
BOOL mAdd; BOOL mAdd;
// [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) | Added: RLVa-1.2.1c
BOOL mRlvForce;
// [/RLVa:KB]
}; };
typedef std::vector<AttachmentsInfo> attachments_vec_t; typedef std::vector<AttachmentsInfo> attachments_vec_t;
......
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llnotifications.h" #include "llnotifications.h"
#include "lltooldraganddrop.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "pipeline.h" #include "pipeline.h"
#include "rlvhelper.h" #include "rlvhelper.h"
...@@ -408,15 +410,26 @@ bool RlvAttachmentLocks::verifyAttachmentLocks() ...@@ -408,15 +410,26 @@ bool RlvAttachmentLocks::verifyAttachmentLocks()
// RlvAttachmentLockWatchdog member functions // RlvAttachmentLockWatchdog member functions
// //
// Checked: 2010-07-28 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i // Checked: 2010-09-15 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c
void RlvAttachmentLockWatchdog::attach(S32 idxAttachPt, const LLUUID& idItem) void RlvAttachmentLockWatchdog::attach(const LLUUID& idItem, S32 idxAttachPt)
{ {
// RELEASE-RLVa: [SL-2.0.0] This will need rewriting for "ENABLE_MULTIATTACHMENTS" const LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
LLSD payload; if (!pItem)
payload["item_id"] = idItem; return;
payload["attachment_point"] = idxAttachPt | ATTACHMENT_ADD;
payload["rlv_force"] = true; LLMessageSystem* pMsg = gMessageSystem;
LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0); 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 // Checked: 2010-07-28 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i
...@@ -651,7 +664,7 @@ void RlvAttachmentLockWatchdog::onSavedAssetIntoInventory(const LLUUID& idItem) ...@@ -651,7 +664,7 @@ void RlvAttachmentLockWatchdog::onSavedAssetIntoInventory(const LLUUID& idItem)
{ {
if ( (!itAttach->second.fAssetSaved) && (idItem == itAttach->second.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(); itAttach->second.tsAttach = LLFrameTimer::getElapsedSeconds();
} }
} }
...@@ -699,7 +712,7 @@ BOOL RlvAttachmentLockWatchdog::onTimer() ...@@ -699,7 +712,7 @@ BOOL RlvAttachmentLockWatchdog::onTimer()
if (fAttach) if (fAttach)
{ {
attach(itAttach->first, itAttach->second.idItem); attach(itAttach->second.idItem, itAttach->first);
itAttach->second.tsAttach = tsCurrent; itAttach->second.tsAttach = tsCurrent;
} }
......
...@@ -153,7 +153,7 @@ protected: ...@@ -153,7 +153,7 @@ protected:
*/ */
protected: protected:
// NOTE: attach/detach do *not* respect attachment locks so use with care // 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(const LLViewerObject* pAttachObj);
void detach(S32 idxAttachPt, const LLViewerObject* pAttachObjExcept = NULL); void detach(S32 idxAttachPt, const LLViewerObject* pAttachObjExcept = NULL);
......
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