diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index a2df874a63..08b7afa6f3 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -165,6 +165,9 @@ public: validate_signal_t* getValidateSignal() { return &mValidateSignal; } sanity_signal_t* getSanitySignal() { return &mSanitySignal; } +// [RLVa:KB] - Patch: RLVa-2.1.0 + bool hasUnsavedValue() { return mValues.size() > 2; } +// [/RLVa:KB] bool isDefault() { return (mValues.size() == 1); } bool isSane(); bool shouldSave(bool nondefault_only); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 8736df25ad..eaa5ec61cd 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1320,14 +1320,12 @@ LLVector3d LLAgent::getPosGlobalFromAgent(const LLVector3 &pos_agent) const void LLAgent::sitDown() { -// setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); -// [RLVa:KB] - Checked: 2010-08-28 (RLVa-1.2.1a) | Added: RLVa-1.2.1a - // RELEASE-RLVa: [SL-2.0.0] Check this function's callers since usually they require explicit blocking - if ( (!rlv_handler_t::isEnabled()) || ((RlvActions::canStand()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) ) - { - setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); - } +// [RLVa:KB] - Checked: RLVa-1.2.1 + if (!RlvActions::canGroundSit()) + return; // [/RLVa:KB] + + setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index d6160da931..7204a30263 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3388,6 +3388,21 @@ bool LLAppViewer::initConfiguration() LLEventPumps::instance().obtain("LLControlGroup").post(LLSDMap("init", *ki)); } +// [RLVa:KB] - Patch: RLVa-2.1.0 + if (LLControlVariable* pControl = gSavedSettings.getControl(RLV_SETTING_MAIN)) + { + if ( (pControl->getValue().asBoolean()) && (pControl->hasUnsavedValue()) ) + { + pControl->resetToDefault(); + pControl->setValue(false); + + std::ostringstream msg; + msg << LLTrans::getString("RLVaToggleMessageLogin", LLSD().with("[STATE]", LLTrans::getString("RLVaToggleDisabled"))); + OSMessageBox(msg.str(), LLStringUtil::null, OSMB_OK); + } + } +// [/RLVa:KB] + return true; // Config was successful. } diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index e1e16c0cb7..0eb0f41ab3 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -254,16 +254,16 @@ bool RlvActions::canPaste(const LLInventoryCategory* pSourceCat, const LLInvento { // The user can paste the specified object into the destination if: // - the source and destination are subject to the same lock type (or none at all) => NOTE: this happens to be the same logic we use for moving - return (isRlvEnabled()) && (pSourceCat) && (pDestCat) && - ((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveFolder(pSourceCat->getUUID(), pDestCat->getUUID()))); + return (!isRlvEnabled()) || + ( (pSourceCat) && (pDestCat) && ((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveFolder(pSourceCat->getUUID(), pDestCat->getUUID()))) ); } bool RlvActions::canPaste(const LLInventoryItem* pSourceItem, const LLInventoryCategory* pDestCat) { // The user can paste the specified object into the destination if: // - the source and destination are subject to the same lock type (or none at all) => NOTE: this happens to be the same logic we use for moving - return (isRlvEnabled()) && (pSourceItem) && (pDestCat) && - ((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveItem(pSourceItem->getUUID(), pDestCat->getUUID()))); + return (!isRlvEnabled()) || + ( (pSourceItem) && (pDestCat) && ((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveItem(pSourceItem->getUUID(), pDestCat->getUUID()))) ); } // ============================================================================ @@ -377,6 +377,14 @@ bool RlvActions::canRez() return (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)); } +bool RlvActions::canGroundSit() +{ + // User can sit on the ground if: + // - not prevented from sitting + // - not prevented from standing up or not currently sitting + return (!hasBehaviour(RLV_BHVR_SIT)) && (canStand()); +} + bool RlvActions::canSit(const LLViewerObject* pObj, const LLVector3& posOffset /*=LLVector3::zero*/) { // User can sit on the specified object if: diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index 44baca33db..1e094fd3f1 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -210,6 +210,11 @@ public: */ static bool canEdit(const LLViewerObject* pObj); + /* + * Returns true if the user can sit on the ground + */ + static bool canGroundSit(); + /* * Returns true if the user can interact with the specified object (with an optional relative offset) * (returns true if pObj == nullptr to not short circuit calling code) @@ -237,7 +242,7 @@ public: static bool canShowLocation(); /* - * Returns true if the user can sit up on the specified object + * Returns true if the user can sit on the specified object (see canGroundSit() for sitting on land) */ static bool canSit(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero); diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index 685ad67bc0..b3689104b2 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -35,8 +35,8 @@ const S32 RLV_VERSION_BUILD_COMPAT = 0; // Implementation version const S32 RLVa_VERSION_MAJOR = 2; -const S32 RLVa_VERSION_MINOR = 0; -const S32 RLVa_VERSION_PATCH = 3; +const S32 RLVa_VERSION_MINOR = 1; +const S32 RLVa_VERSION_PATCH = 0; // Uncomment before a final release #define RLV_RELEASE diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 093e4f3dee..31420d4d24 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -2570,30 +2570,43 @@ ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvCm template<> template<> ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvCmd) { - LLViewerObject* pObj = NULL; LLUUID idTarget(rlvCmd.getOption()); - // Sanity checking - we need to know about the object and it should identify a prim/linkset - if ( (idTarget.isNull()) || ((pObj = gObjectList.findObject(idTarget)) == NULL) || (LL_PCODE_VOLUME != pObj->getPCode()) ) + LLUUID idTarget; + if (!RlvCommandOptionHelper::parseOption(rlvCmd.getOption(), idTarget)) return RLV_RET_FAILED_OPTION; - if (!RlvActions::canSit(pObj)) - return RLV_RET_FAILED_LOCK; - else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) ) + LLViewerObject* pObj = NULL; + if (idTarget.isNull()) { - if (gAgentAvatarp->isSitting()) + if (!RlvActions::canGroundSit()) return RLV_RET_FAILED_LOCK; - gRlvHandler.m_posSitSource = gAgent.getPositionGlobal(); + gAgent.sitDown(); } + else if ( ((pObj = gObjectList.findObject(idTarget)) != NULL) && (LL_PCODE_VOLUME == pObj->getPCode())) + { + if (!RlvActions::canSit(pObj)) + return RLV_RET_FAILED_LOCK; - // Copy/paste from handle_sit_or_stand() - gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gMessageSystem->nextBlockFast(_PREHASH_TargetObject); - gMessageSystem->addUUIDFast(_PREHASH_TargetID, pObj->mID); - gMessageSystem->addVector3Fast(_PREHASH_Offset, LLVector3::zero); - pObj->getRegion()->sendReliableMessage(); + if ((gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid())) + { + if (gAgentAvatarp->isSitting()) + return RLV_RET_FAILED_LOCK; + gRlvHandler.m_posSitSource = gAgent.getPositionGlobal(); + } + // Copy/paste from handle_sit_or_stand() + gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gMessageSystem->nextBlockFast(_PREHASH_TargetObject); + gMessageSystem->addUUIDFast(_PREHASH_TargetID, pObj->mID); + gMessageSystem->addVector3Fast(_PREHASH_Offset, LLVector3::zero); + pObj->getRegion()->sendReliableMessage(); + } + else + { + return RLV_RET_FAILED_OPTION; + } return RLV_RET_SUCCESS; } diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 9c01c51719..3cc1a4a979 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -610,13 +610,7 @@ bool RlvCommand::parseCommand(const std::string& strCommand, std::string& strBeh template<> bool RlvCommandOptionHelper::parseOption(const std::string& strOption, LLUUID& idOption) { - if (!LLUUID::validate(strOption)) - { - return false; - } - - idOption.set(strOption); - return idOption.notNull(); + return idOption.set(strOption, false); } template<>