From 43bd5d830352af80cd7dbc8391948957f567c410 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sat, 21 Nov 2020 23:04:53 +0100 Subject: [PATCH] [FIXED] Holding the @setenv restriction isn't preventing other objects from changing the environment settings --- indra/newview/rlvactions.cpp | 6 ++++-- indra/newview/rlvactions.h | 4 ++-- indra/newview/rlvenvironment.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index 379bc14e91..b5126ee47b 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -366,9 +366,11 @@ bool RlvActions::isLocalTp(const LLVector3d& posGlobal) // WindLight // -bool RlvActions::canChangeEnvironment() +bool RlvActions::canChangeEnvironment(const LLUUID& idRlvObject) { - return !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV); + // User can (partially) change their environment settings if: + // - not specifically restricted from changing their environment (by any object other than the one specified) + return (idRlvObject.isNull()) ? !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV) : !gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETENV, idRlvObject); } // ============================================================================ diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index fb2e14f7aa..7022e33eeb 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -218,9 +218,9 @@ public: // ========= public: /* - * Returns true if the user can make changes to their WindLight environment + * Returns true if the user can make changes to their WindLight environment */ - static bool canChangeEnvironment(); + static bool canChangeEnvironment(const LLUUID& idRlvObject = LLUUID::null); // ================= diff --git a/indra/newview/rlvenvironment.cpp b/indra/newview/rlvenvironment.cpp index 0f1dceef63..5f70df750a 100644 --- a/indra/newview/rlvenvironment.cpp +++ b/indra/newview/rlvenvironment.cpp @@ -502,6 +502,12 @@ bool RlvEnvironment::onHandleCommand(const RlvCommand& rlvCmd, ERlvCmdRet& cmdRe { if ( (rlvCmd.getBehaviour().length() > strCmdPrefix.length() + 2) && (boost::starts_with(rlvCmd.getBehaviour(), strCmdPrefix)) ) { + if ( (RLV_TYPE_FORCE == rlvCmd.getParamType()) && (!RlvActions::canChangeEnvironment(rlvCmd.getObjectID())) ) + { + cmdRet = RLV_RET_FAILED_LOCK; + return true; + } + std::string strEnvCommand = rlvCmd.getBehaviour().substr(strCmdPrefix.length()); handler_map_t::const_iterator itFnEntry = fnLookup.find(strEnvCommand);