aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/rlvhandler.h
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-10-16 16:39:44 -0700
committerMcCabe Maxsted2009-10-16 16:39:44 -0700
commitce82adec2a0124fe27f363653d2652b0f5c61f04 (patch)
tree35b3877b1d1fc92329a44a9a17d183b74b92890b /linden/indra/newview/rlvhandler.h
parentApplied patch for VWR-6787 by Alissa Sabre - 'none' text in group window not ... (diff)
downloadmeta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.zip
meta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.tar.gz
meta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.tar.bz2
meta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.tar.xz
Applied RLVa-1.0.4e_20091010_SL-1.22.11-diff.patch
Diffstat (limited to 'linden/indra/newview/rlvhandler.h')
-rw-r--r--linden/indra/newview/rlvhandler.h108
1 files changed, 44 insertions, 64 deletions
diff --git a/linden/indra/newview/rlvhandler.h b/linden/indra/newview/rlvhandler.h
index 4470632..5295a72 100644
--- a/linden/indra/newview/rlvhandler.h
+++ b/linden/indra/newview/rlvhandler.h
@@ -18,7 +18,7 @@
18typedef std::map<LLUUID, RlvObject> rlv_object_map_t; 18typedef std::map<LLUUID, RlvObject> rlv_object_map_t;
19typedef std::multimap<S32, LLUUID> rlv_detach_map_t; 19typedef std::multimap<S32, LLUUID> rlv_detach_map_t;
20typedef std::map<S32, LLUUID> rlv_reattach_map_t; 20typedef std::map<S32, LLUUID> rlv_reattach_map_t;
21typedef std::multimap<LLUUID, ERlvBehaviour> rlv_exception_map_t; 21typedef std::multimap<ERlvBehaviour, RlvException> rlv_exception_map_t;
22 22
23class RlvHandler 23class RlvHandler
24{ 24{
@@ -29,7 +29,7 @@ public:
29 // -------------------------------- 29 // --------------------------------
30 30
31 /* 31 /*
32 * Rule checking functions 32 * Attachment point helper functions
33 */ 33 */
34public: 34public:
35 // Returns a pointer to the attachment point for a supplied parameter 35 // Returns a pointer to the attachment point for a supplied parameter
@@ -42,45 +42,45 @@ public:
42 S32 getAttachPointIndex(const LLViewerJointAttachment* pObj) const; 42 S32 getAttachPointIndex(const LLViewerJointAttachment* pObj) const;
43 bool hasAttachPointName(const LLInventoryItem* pItem, bool fStrict) const; 43 bool hasAttachPointName(const LLInventoryItem* pItem, bool fStrict) const;
44 44
45 // Returns TRUE is at least one object contains the specified behaviour (and optional parameter) 45 // --------------------------------
46
47 /*
48 * Rule checking functions
49 */
46 // NOTE: - to check @detach=n -> hasLockedAttachment() / hasLockedHUD() / isDetachable() 50 // NOTE: - to check @detach=n -> hasLockedAttachment() / hasLockedHUD() / isDetachable()
51 // - to check exceptions -> isException()
47 // - to check @addoutfit=n -> isWearable() 52 // - to check @addoutfit=n -> isWearable()
48 // - to check @remoutfit=n -> isRemovable() 53 // - to check @remoutfit=n -> isRemovable()
49 // - to check exceptions -> isException() 54public:
50 // (You *can* use hasBehaviour(); the specialized ones just don't have to iterate over all the objects) 55 // Returns TRUE is at least one object contains the specified behaviour (and optional option)
51 bool hasBehaviour(ERlvBehaviour eBehaviour) const { return (eBehaviour < RLV_BHVR_COUNT) ? (0 != m_Behaviours[eBehaviour]) : false; } 56 bool hasBehaviour(ERlvBehaviour eBehaviour) const { return (eBehaviour < RLV_BHVR_COUNT) ? (0 != m_Behaviours[eBehaviour]) : false; }
52 bool hasBehaviour(const std::string& strBehaviour) const;
53 bool hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const; 57 bool hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const;
54 bool hasBehaviour(const std::string& strBehaviour, const std::string& strOption) const; 58 // Returns TRUE if at least one object (except the specified one) contains the specified behaviour (and optional option)
55
56 // Returns TRUE if at least one object (except the specified one) contains the specified behaviour
57 bool hasBehaviourExcept(ERlvBehaviour eBehaviour, const LLUUID& idObj) const; 59 bool hasBehaviourExcept(ERlvBehaviour eBehaviour, const LLUUID& idObj) const;
58 bool hasBehaviourExcept(const std::string& strBehaviour, const LLUUID& uuid) const;
59 bool hasBehaviourExcept(ERlvBehaviour eBehaviour, const std::string& strOption, const LLUUID& idObj) const; 60 bool hasBehaviourExcept(ERlvBehaviour eBehaviour, const std::string& strOption, const LLUUID& idObj) const;
60 bool hasBehaviourExcept(const std::string& strBehaviour, const std::string& strOption, const LLUUID& idObj) const;
61 61
62 // Returns TRUE if there is at least 1 undetachable attachment 62 // Returns TRUE if there is at least 1 non-detachable attachment
63 bool hasLockedAttachment() const { return (0 != m_Attachments.size()); } 63 bool hasLockedAttachment() const { return (0 != m_Attachments.size()); }
64 // Returns TRUE if there is at least 1 undetachable HUD attachment 64 // Returns TRUE if there is at least 1 non-detachable HUD attachment
65 bool hasLockedHUD() const; 65 bool hasLockedHUD() const;
66
67 // Returns TRUE if the specified attachment point is detachable 66 // Returns TRUE if the specified attachment point is detachable
68 bool isDetachable(S32 idxAttachPt) const { return (idxAttachPt) && (m_Attachments.find(idxAttachPt) == m_Attachments.end()); } 67 bool isDetachable(S32 idxAttachPt) const { return (idxAttachPt) && (m_Attachments.find(idxAttachPt) == m_Attachments.end()); }
69 bool isDetachable(const LLInventoryItem* pItem) const; 68 bool isDetachable(const LLInventoryItem* pItem) const;
70 bool isDetachable(LLViewerJointAttachment* pAttachPt) const; 69 bool isDetachable(LLViewerJointAttachment* pAttachPt) const;
71 bool isDetachable(LLViewerObject* pObj) const; 70 bool isDetachable(LLViewerObject* pObj) const;
72 // Returns TRUE if the specified attachment point is set undetachable by anything other than pObj (or one of its children) 71 // Returns TRUE if the specified attachment point is set non-detachable by anything other than pObj (or one of its children)
73 bool isDetachableExcept(S32 idxAttachPt, LLViewerObject* pObj) const; 72 bool isDetachableExcept(S32 idxAttachPt, LLViewerObject* pObj) const;
74 // Marks the specified attachment point as (un)detachable (return value indicates success ; used by unit tests) 73 // Marks the specified attachment point as (non-)detachable (return value indicates success ; used by unit tests)
75 bool setDetachable(S32 idxAttachPt, const LLUUID& idRlvObj, bool fDetachable); 74 bool setDetachable(S32 idxAttachPt, const LLUUID& idRlvObj, bool fDetachable);
76 bool setDetachable(LLViewerObject* pObj, const LLUUID& idRlvObj, bool fDetachable); 75 bool setDetachable(LLViewerObject* pObj, const LLUUID& idRlvObj, bool fDetachable);
77 76
78 // Adds or removes an exception for the specified restriction 77 // Adds or removes an exception for the specified behaviour
79 void addException(ERlvBehaviour eBehaviour, const LLUUID& uuid); 78 void addException(const LLUUID& idObj, ERlvBehaviour eBhvr, const RlvExceptionOption& varOption);
80 void removeException(ERlvBehaviour eBehaviour, const LLUUID& uuid); 79 void removeException(const LLUUID& idObj, ERlvBehaviour eBhvr, const RlvExceptionOption& varOption);
81 // Returns TRUE is the specified UUID is exempt from a restriction (tplure/sendim/recvim/etc) 80 // Returns TRUE if the specified option was added as an exception for the specified behaviour
82 bool isException(ERlvBehaviour eBehaviour, const LLUUID& uuid) const; 81 bool isException(ERlvBehaviour eBhvr, const RlvExceptionOption& varOption, ERlvExceptionCheck typeCheck = RLV_CHECK_DEFAULT) const;
83 bool isException(const std::string& strBehaviour, const LLUUID& uuid) const; 82 // Returns TRUE if the specified behaviour should behave "permissive" (rather than "strict"/"secure")
83 bool isPermissive(ERlvBehaviour eBhvr) const;
84 84
85 // Returns TRUE if the specified layer is removable (use hasBehaviour(RLV_BHVR_REMOUTFIT) for the general case) 85 // Returns TRUE if the specified layer is removable (use hasBehaviour(RLV_BHVR_REMOUTFIT) for the general case)
86 bool isRemovable(EWearableType type) const { return (type < WT_COUNT) ? (0 == m_LayersRem[type]) : true; } 86 bool isRemovable(EWearableType type) const { return (type < WT_COUNT) ? (0 == m_LayersRem[type]) : true; }
@@ -121,6 +121,7 @@ public:
121 void filterNames(std::string& strUTF8Text) const; // @shownames 121 void filterNames(std::string& strUTF8Text) const; // @shownames
122 const std::string& getAnonym(const std::string& strName) const; // @shownames 122 const std::string& getAnonym(const std::string& strName) const; // @shownames
123 std::string getVersionString() const; // @version 123 std::string getVersionString() const; // @version
124 std::string getVersionNumString() const; // @versionnum
124 BOOL isAgentNearby(const LLUUID& uuid) const; // @shownames 125 BOOL isAgentNearby(const LLUUID& uuid) const; // @shownames
125 bool redirectChatOrEmote(const std::string& strUTF8Test) const; // @redirchat and @rediremote 126 bool redirectChatOrEmote(const std::string& strUTF8Test) const; // @redirchat and @rediremote
126 127
@@ -274,11 +275,10 @@ extern rlv_handler_t gRlvHandler;
274// Inlined member functions 275// Inlined member functions
275// 276//
276 277
277// Checked: 2009-07-09 (RLVa-1.0.0f) 278// Checked: 2009-10-04 (RLVa-1.0.4a) | Modified: RLVa-1.0.4a
278inline void RlvHandler::addException(ERlvBehaviour eBehaviour, const LLUUID& uuid) 279inline void RlvHandler::addException(const LLUUID& idObj, ERlvBehaviour eBhvr, const RlvExceptionOption& varOption)
279{ 280{
280 if (!uuid.isNull()) 281 m_Exceptions.insert(std::pair<ERlvBehaviour, RlvException>(eBhvr, RlvException(idObj, eBhvr, varOption)));
281 m_Exceptions.insert(std::pair<LLUUID, ERlvBehaviour>(uuid, eBehaviour));
282} 282}
283 283
284// Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f 284// Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f
@@ -288,7 +288,7 @@ inline bool RlvHandler::canShowHoverText(LLViewerObject *pObj) const
288 !( (hasBehaviour(RLV_BHVR_SHOWHOVERTEXTALL)) || 288 !( (hasBehaviour(RLV_BHVR_SHOWHOVERTEXTALL)) ||
289 ( (hasBehaviour(RLV_BHVR_SHOWHOVERTEXTWORLD)) && (!pObj->isHUDAttachment()) ) || 289 ( (hasBehaviour(RLV_BHVR_SHOWHOVERTEXTWORLD)) && (!pObj->isHUDAttachment()) ) ||
290 ( (hasBehaviour(RLV_BHVR_SHOWHOVERTEXTHUD)) && (pObj->isHUDAttachment()) ) || 290 ( (hasBehaviour(RLV_BHVR_SHOWHOVERTEXTHUD)) && (pObj->isHUDAttachment()) ) ||
291 (isException(RLV_BHVR_SHOWHOVERTEXT, pObj->getID())) ) ); 291 (isException(RLV_BHVR_SHOWHOVERTEXT, pObj->getID(), RLV_CHECK_PERMISSIVE)) ) );
292} 292}
293 293
294// Checked: 2009-05-23 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d 294// Checked: 2009-05-23 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d
@@ -321,6 +321,12 @@ inline std::string RlvHandler::getVersionString() const
321 RLVa_VERSION_MAJOR, RLVa_VERSION_MINOR, RLVa_VERSION_PATCH); 321 RLVa_VERSION_MAJOR, RLVa_VERSION_MINOR, RLVa_VERSION_PATCH);
322} 322}
323 323
324// Checked: 2009-10-04 (RLVa-1.0.4b) | Added: RLVa-1.0.4b
325inline std::string RlvHandler::getVersionNumString() const
326{
327 return llformat("%d%02d%02d%02d", RLV_VERSION_MAJOR, RLV_VERSION_MINOR, RLV_VERSION_PATCH, RLV_VERSION_BUILD);
328}
329
324// Checked: 2009-05-23 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d 330// Checked: 2009-05-23 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d
325inline bool RlvHandler::hasAttachPointName(const LLInventoryItem *pItem, bool fStrict) const 331inline bool RlvHandler::hasAttachPointName(const LLInventoryItem *pItem, bool fStrict) const
326{ 332{
@@ -334,18 +340,6 @@ inline bool RlvHandler::hasBehaviour(ERlvBehaviour eBehaviour, const std::string
334} 340}
335 341
336// Checked: 342// Checked:
337inline bool RlvHandler::hasBehaviour(const std::string& strBehaviour) const
338{
339 return hasBehaviourExcept(strBehaviour, LLUUID::null);
340}
341
342// Checked:
343inline bool RlvHandler::hasBehaviour(const std::string& strBehaviour, const std::string& strOption) const
344{
345 return hasBehaviourExcept(strBehaviour, strOption, LLUUID::null);
346}
347
348// Checked:
349inline bool RlvHandler::hasBehaviourExcept(ERlvBehaviour eBehaviour, const LLUUID& idObj) const 343inline bool RlvHandler::hasBehaviourExcept(ERlvBehaviour eBehaviour, const LLUUID& idObj) const
350{ 344{
351 return hasBehaviourExcept(eBehaviour, std::string(), idObj); 345 return hasBehaviourExcept(eBehaviour, std::string(), idObj);
@@ -379,22 +373,11 @@ inline bool RlvHandler::isDetachable(LLViewerObject* pObj) const
379 return (pObj == NULL) || (!pObj->isAttachment()) || (isDetachable(getAttachPointIndex(pObj))); 373 return (pObj == NULL) || (!pObj->isAttachment()) || (isDetachable(getAttachPointIndex(pObj)));
380} 374}
381 375
382// Checked: 376inline bool RlvHandler::isPermissive(ERlvBehaviour eBhvr) const
383inline bool RlvHandler::isException(ERlvBehaviour eBehaviour, const LLUUID& uuid) const
384{
385 for (rlv_exception_map_t::const_iterator itException = m_Exceptions.lower_bound(uuid),
386 endException = m_Exceptions.upper_bound(uuid); itException != endException; ++itException)
387 {
388 if (itException->second == eBehaviour)
389 return true;
390 }
391 return false;
392}
393
394// Checked:
395inline bool RlvHandler::isException(const std::string& strBehaviour, const LLUUID& uuid) const
396{ 377{
397 return hasBehaviour(strBehaviour, uuid.asString()); 378 return (RlvCommand::hasStrictVariant(eBhvr))
379 ? !((hasBehaviour(RLV_BHVR_PERMISSIVE)) || (isException(RLV_BHVR_PERMISSIVE, eBhvr, RLV_CHECK_PERMISSIVE)))
380 : true;
398} 381}
399 382
400// Checked: 2009-07-29 (RLVa-1.0.1b) | Added: RLVa-1.0.1b 383// Checked: 2009-07-29 (RLVa-1.0.1b) | Added: RLVa-1.0.1b
@@ -428,19 +411,16 @@ inline bool RlvHandler::isRemovableExcept(EWearableType type, const LLUUID& idOb
428 } 411 }
429#endif // RLV_EXTENSION_FLAG_NOSTRIP 412#endif // RLV_EXTENSION_FLAG_NOSTRIP
430 413
431// Checked: 2009-07-09 (RLVa-1.0.0f) 414// Checked: 2009-10-04 (RLVa-1.0.4a) | Modified: RLVa-1.0.4a
432inline void RlvHandler::removeException(ERlvBehaviour eBehaviour, const LLUUID &uuid) 415inline void RlvHandler::removeException(const LLUUID& idObj, ERlvBehaviour eBhvr, const RlvExceptionOption& varOption)
433{ 416{
434 if (!uuid.isNull()) 417 for (rlv_exception_map_t::iterator itException = m_Exceptions.lower_bound(eBhvr),
418 endException = m_Exceptions.upper_bound(eBhvr); itException != endException; ++itException)
435 { 419 {
436 for (rlv_exception_map_t::iterator itException = m_Exceptions.lower_bound(uuid), 420 if ( (itException->second.idObject == idObj) && (itException->second.varOption == varOption) )
437 endException = m_Exceptions.upper_bound(uuid); itException != endException; ++itException)
438 { 421 {
439 if (itException->second == eBehaviour) 422 m_Exceptions.erase(itException);
440 { 423 break;
441 m_Exceptions.erase(itException);
442 break;
443 }
444 } 424 }
445 } 425 }
446} 426}