Permalink
Browse files

Update RLVLocks

  • Loading branch information...
Lirusaito committed May 26, 2016
1 parent cfea4f4 commit fb9101598a0c6bd41c246534b756c4177efc1200
Showing with 35 additions and 31 deletions.
  1. +18 −18 indra/newview/rlvlocks.cpp
  2. +17 −13 indra/newview/rlvlocks.h
View
@@ -516,7 +516,7 @@ void RlvAttachmentLockWatchdog::RlvWearInfo::dumpInstance() const
for (std::map<S32, uuid_vec_t>::const_iterator itAttachPt = attachPts.begin(); itAttachPt != attachPts.end(); ++itAttachPt)
{
const LLViewerJointAttachment* pAttachPt =
- get_if_there(gAgentAvatarp->mAttachmentPoints, itAttachPt->first, (LLViewerJointAttachment*)NULL);
+ get_if_there(gAgentAvatarp->mAttachmentPoints, itAttachPt->first, static_cast<LLViewerJointAttachment*>(NULL));
if (!itAttachPt->second.empty())
{
for (uuid_vec_t::const_iterator itAttach = itAttachPt->second.begin(); itAttach != itAttachPt->second.end(); ++itAttach)
@@ -655,21 +655,21 @@ void RlvAttachmentLockWatchdog::onAttach(const LLViewerObject* pAttachObj, const
for (LLViewerJointAttachment::attachedobjs_vec_t::const_iterator itAttachObj = pAttachPt->mAttachedObjects.begin();
itAttachObj != pAttachPt->mAttachedObjects.end(); ++itAttachObj)
{
- const LLViewerObject* pAttachObj = *itAttachObj;
+ const LLViewerObject* p_attach_obj = *itAttachObj;
- uuid_vec_t::iterator itAttach =
- std::find(itAttachPrev->second.begin(), itAttachPrev->second.end(), pAttachObj->getAttachmentItemID());
- if (itAttach == itAttachPrev->second.end())
- detach(pAttachObj);
+ uuid_vec_t::iterator it_attach =
+ std::find(itAttachPrev->second.begin(), itAttachPrev->second.end(), p_attach_obj->getAttachmentItemID());
+ if (it_attach == itAttachPrev->second.end())
+ detach(p_attach_obj);
else
- itAttachPrev->second.erase(itAttach);
+ itAttachPrev->second.erase(it_attach);
}
// Whatever is left is something that needs to be reattached
- for (uuid_vec_t::const_iterator itAttach = itAttachPrev->second.begin();
- itAttach != itAttachPrev->second.end(); ++itAttach)
+ for (uuid_vec_t::const_iterator it_attach = itAttachPrev->second.begin();
+ it_attach != itAttachPrev->second.end(); ++it_attach)
{
- m_PendingAttach.insert(std::pair<S32, RlvReattachInfo>(idxAttachPt, RlvReattachInfo(*itAttach)));
+ m_PendingAttach.insert(std::pair<S32, RlvReattachInfo>(idxAttachPt, RlvReattachInfo(*it_attach)));
}
}
fAttachAllowed = false;
@@ -759,7 +759,7 @@ void RlvAttachmentLockWatchdog::onSavedAssetIntoInventory(const LLUUID& idItem)
{
if ( (!itAttach->second.fAssetSaved) && (idItem == itAttach->second.idItem) )
{
- LLAttachmentsMgr::instance().addAttachment(itAttach->second.idItem, itAttach->first, true, true);
+ LLAttachmentsMgr::instance().addAttachmentRequest(itAttach->second.idItem, itAttach->first, true, true);
itAttach->second.tsAttach = LLFrameTimer::getElapsedSeconds();
}
}
@@ -807,7 +807,7 @@ BOOL RlvAttachmentLockWatchdog::onTimer()
if (fAttach)
{
- LLAttachmentsMgr::instance().addAttachment(itAttach->second.idItem, itAttach->first, true, true);
+ LLAttachmentsMgr::instance().addAttachmentRequest(itAttach->second.idItem, itAttach->first, true, true);
itAttach->second.tsAttach = tsCurrent;
}
@@ -1019,7 +1019,7 @@ class RlvLockedDescendentsCollector : public LLInventoryCollectFunctor
{
public:
RlvLockedDescendentsCollector(int eSourceTypeMask, RlvFolderLocks::ELockPermission ePermMask, ERlvLockMask eLockTypeMask)
- : m_eSourceTypeMask(eSourceTypeMask), m_ePermMask(ePermMask), m_eLockTypeMask(eLockTypeMask) {}
+ : m_ePermMask(ePermMask), m_eSourceTypeMask(eSourceTypeMask), m_eLockTypeMask(eLockTypeMask) {}
/*virtual*/ ~RlvLockedDescendentsCollector() {}
/*virtual*/ bool operator()(LLInventoryCategory* pFolder, LLInventoryItem* pItem)
{
@@ -1033,7 +1033,7 @@ class RlvLockedDescendentsCollector : public LLInventoryCollectFunctor
// Checked: 2011-03-28 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g
RlvFolderLocks::RlvFolderLocks()
- : m_fLookupDirty(false), m_fLockedRoot(false), m_cntLockAdd(0), m_cntLockRem(0)
+ : m_cntLockAdd(0), m_cntLockRem(0), m_fLookupDirty(false), m_fLockedRoot(false)
{
LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&RlvFolderLocks::onNeedsLookupRefresh, this));
RlvInventory::instance().addSharedRootIDChangedCallback(boost::bind(&RlvFolderLocks::onNeedsLookupRefresh, this));
@@ -1165,8 +1165,8 @@ bool RlvFolderLocks::getLockedItems(const LLUUID& idFolder, LLInventoryModel::it
{
LLInventoryModel::item_array_t itemLinks;
LLInventoryModel::cat_array_t cats;
- LLLinkedItemIDMatches f(pItem->getUUID());
- gInventory.collectDescendentsIf(RlvInventory::instance().getSharedRootID(), cats, itemLinks, LLInventoryModel::EXCLUDE_TRASH, f);
+ LLLinkedItemIDMatches item_id_matches(pItem->getUUID());
+ gInventory.collectDescendentsIf(RlvInventory::instance().getSharedRootID(), cats, itemLinks, LLInventoryModel::EXCLUDE_TRASH, item_id_matches);
for (LLInventoryModel::item_array_t::iterator itItemLink = itemLinks.begin();
(itItemLink < itemLinks.end()) && (!fItemLocked); ++itItemLink)
@@ -1256,7 +1256,7 @@ bool RlvFolderLocks::isLockedFolder(LLUUID idFolder, ERlvLockMask eLockTypeMask,
// - it's a node lock and the current folder doesn't match
// - we encountered a PERM_ALLOW lock from the current lock owner before which supercedes any subsequent locks
// - the lock source type doesn't match the mask passed in eSourceTypeMask
- ERlvLockMask eCurLockType = (ERlvLockMask)(pLockDescr->eLockType & eLockTypeMask);
+ ERlvLockMask eCurLockType = static_cast<ERlvLockMask>(pLockDescr->eLockType & eLockTypeMask);
std::list<LLUUID>* pidRlvObjList = (RLV_LOCK_REMOVE == eCurLockType) ? &idsRlvObjRem : &idsRlvObjAdd;
if ( (0 == eCurLockType) || ((SCOPE_NODE == pLockDescr->eLockScope) && (idFolder != idFolderCur)) ||
(pidRlvObjList->end() != std::find(pidRlvObjList->begin(), pidRlvObjList->end(), pLockDescr->idRlvObj)) ||
@@ -1286,7 +1286,7 @@ bool RlvFolderLocks::isLockedFolder(LLUUID idFolder, ERlvLockMask eLockTypeMask,
}
// Checked: 2010-11-30 (RLVa-1.3.0b) | Added: RLVa-1.3.0b
-void RlvFolderLocks::onNeedsLookupRefresh()
+void RlvFolderLocks::onNeedsLookupRefresh() const
{
// NOTE: when removeFolderLock() removes the last folder lock we still want to refresh everything so mind the conditional OR assignment
m_fLookupDirty |= !m_FolderLocks.empty();
View
@@ -17,7 +17,6 @@
#ifndef RLV_LOCKS_H
#define RLV_LOCKS_H
-#include "llagentconstants.h"
#include "llagentwearables.h"
#include "lleventtimer.h"
#include "llvoavatarself.h"
@@ -123,7 +122,8 @@ class RlvAttachmentLocks
typedef std::multimap<S32, LLUUID> rlv_attachptlock_map_t;
// Accessors for RlvFloaterLocks
const rlv_attachptlock_map_t& getAttachPtLocks(ERlvLockMask eLock) { return (RLV_LOCK_ADD == eLock) ? m_AttachPtAdd : m_AttachPtRem; }
- const rlv_attachobjlock_map_t& getAttachObjLocks() { return m_AttachObjRem; }
+ const rlv_attachobjlock_map_t& getAttachObjLocks() const
+ { return m_AttachObjRem; }
private:
rlv_attachptlock_map_t m_AttachPtAdd; // Map of attachment points that can't be attached to (idxAttachPt -> idObj)
rlv_attachptlock_map_t m_AttachPtRem; // Map of attachment points whose attachments can't be detached (idxAttachPt -> idObj)
@@ -202,8 +202,8 @@ class RlvAttachmentLockWatchdog : public LLSingleton<RlvAttachmentLockWatchdog>
ERlvWearMask eWearAction;
F64 tsWear;
std::map<S32, uuid_vec_t> attachPts;
- protected:
- RlvWearInfo();
+ //protected:
+ //RlvWearInfo(); // not implemented
};
typedef std::map<LLUUID, RlvWearInfo> rlv_wear_map_t;
rlv_wear_map_t m_PendingWear;
@@ -355,7 +355,7 @@ class RlvFolderLocks : public LLSingleton<RlvFolderLocks>
protected:
bool getLockedFolders(const folderlock_source_t& lockSource, LLInventoryModel::cat_array_t& lockFolders) const;
bool getLockedItems(const LLUUID& idFolder, LLInventoryModel::item_array_t& lockItems) const;
- void onNeedsLookupRefresh();
+ void onNeedsLookupRefresh() const;
void refreshLockedLookups() const;
/*
@@ -364,9 +364,12 @@ class RlvFolderLocks : public LLSingleton<RlvFolderLocks>
public:
typedef std::list<const folderlock_descr_t*> folderlock_list_t;
// Accessors for RlvFloaterLocks
- const folderlock_list_t& getFolderLocks() { return m_FolderLocks; }
- const uuid_vec_t& getAttachmentLookups() { return m_LockedAttachmentRem; }
- const uuid_vec_t& getWearableLookups() { return m_LockedWearableRem; }
+ const folderlock_list_t& getFolderLocks() const
+ { return m_FolderLocks; }
+ const uuid_vec_t& getAttachmentLookups() const
+ { return m_LockedAttachmentRem; }
+ const uuid_vec_t& getWearableLookups() const
+ { return m_LockedWearableRem; }
protected:
// Map of folder locks (idRlvObj -> lockDescr)
folderlock_list_t m_FolderLocks; // List of add and remove locked folder descriptions
@@ -391,19 +394,19 @@ class RlvFolderLocks : public LLSingleton<RlvFolderLocks>
// Checked: 2010-11-30 (RLVa-1.4.0b) | Added: RLVa-1.4.0b
inline LLViewerJointAttachment* RlvAttachPtLookup::getAttachPoint(S32 idxAttachPt)
{
- return (isAgentAvatarValid()) ? get_if_there(gAgentAvatarp->mAttachmentPoints, idxAttachPt, (LLViewerJointAttachment*)NULL) : NULL;
+ return (isAgentAvatarValid()) ? get_if_there(gAgentAvatarp->mAttachmentPoints, idxAttachPt, static_cast<LLViewerJointAttachment*>(NULL)) : NULL;
}
// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-0.2.0d
inline LLViewerJointAttachment* RlvAttachPtLookup::getAttachPoint(const std::string& strText)
{
- return (isAgentAvatarValid()) ? get_if_there(gAgentAvatarp->mAttachmentPoints, getAttachPointIndex(strText), (LLViewerJointAttachment*)NULL) : NULL;
+ return (isAgentAvatarValid()) ? get_if_there(gAgentAvatarp->mAttachmentPoints, getAttachPointIndex(strText), static_cast<LLViewerJointAttachment*>(NULL)) : NULL;
}
// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.0.1b
inline LLViewerJointAttachment* RlvAttachPtLookup::getAttachPoint(const LLInventoryItem* pItem)
{
- return (isAgentAvatarValid()) ? get_if_there(gAgentAvatarp->mAttachmentPoints, getAttachPointIndex(pItem), (LLViewerJointAttachment*)NULL) : NULL;
+ return (isAgentAvatarValid()) ? get_if_there(gAgentAvatarp->mAttachmentPoints, getAttachPointIndex(pItem), static_cast<LLViewerJointAttachment*>(NULL)) : NULL;
}
// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
@@ -447,12 +450,12 @@ inline ERlvWearMask RlvAttachmentLocks::canAttach(const LLViewerJointAttachment*
// Empty attachment point => RLV_WEAR_ADD | RLV_WEAR_REPLACE
RLV_ASSERT(pAttachPt); // TODO-RLVa: [RLVa-1.2.1] Maybe it's better to just return something similar like above?
return
- (ERlvWearMask)(((pAttachPt) && (!isLockedAttachmentPoint(pAttachPt, RLV_LOCK_ADD)))
+ static_cast<ERlvWearMask>(((pAttachPt) && (!isLockedAttachmentPoint(pAttachPt, RLV_LOCK_ADD)))
? ((canDetach(pAttachPt, true)) ? RLV_WEAR_REPLACE : 0) | RLV_WEAR_ADD
: RLV_WEAR_LOCKED);
}
-// Checked: 2010-02-28 (RLVa-1.2.0a) | Added: RLVa-1.0.5a
+// Checked: 2010-02-28 (RLVa-1.2.0)
inline bool RlvAttachmentLocks::canDetach(const LLInventoryItem* pItem) const
{
const LLViewerObject* pAttachObj =
@@ -476,6 +479,7 @@ inline bool RlvAttachmentLocks::isLockedAttachment(const LLViewerObject* pAttach
RLV_ASSERT( (!pAttachObj) || (pAttachObj == pAttachObj->getRootEdit()) );
// Object is locked if:
+ // - it's not a temporary attachment
// - it's specifically marked as non-detachable (ie @detach=n)
// - it's attached to an attachment point that is RLV_LOCK_REMOVE locked (ie @remattach:<attachpt>=n)
// - it's part of a locked folder

0 comments on commit fb91015

Please sign in to comment.