/** * * Copyright (c) 2009-2010, Kitty Barnett * * The source code in this file is provided to you under the terms of the * GNU General Public License, version 2.0, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. Terms of the GPL can be found in doc/GPL-license.txt * in this distribution, or online at http://www.gnu.org/licenses/gpl-2.0.txt * * By copying, modifying or distributing this software, you acknowledge that * you have read and understood your obligations described above, and agree to * abide by those obligations. * */ #include "llviewerprecompiledheaders.h" #include "llagent.h" #include "llfloaterwindlight.h" #include "llviewercontrol.h" #include "llviewerwindow.h" #include "llvoavatar.h" #include "llwlparammanager.h" #include "rlvextensions.h" #include "rlvhandler.h" // ============================================================================ std::map RlvExtGetSet::m_DbgAllowed; std::map RlvExtGetSet::m_PseudoDebug; // Checked: 2009-06-03 (RLVa-0.2.0h) | Modified: RLVa-0.2.0h RlvExtGetSet::RlvExtGetSet() { if (!m_DbgAllowed.size()) // m_DbgAllowed is static and should only be initialized once { m_DbgAllowed.insert(std::pair("AvatarSex", DBG_READ | DBG_WRITE | DBG_PSEUDO)); m_DbgAllowed.insert(std::pair("RenderResolutionDivisor", DBG_READ | DBG_WRITE)); #ifdef RLV_EXTENSION_CMD_GETSETDEBUG_EX m_DbgAllowed.insert(std::pair(RLV_SETTING_FORBIDGIVETORLV, DBG_READ)); m_DbgAllowed.insert(std::pair(RLV_SETTING_NOSETENV, DBG_READ)); m_DbgAllowed.insert(std::pair("WindLightUseAtmosShaders", DBG_READ)); #endif // RLV_EXTENSION_CMD_GETSETDEBUG_EX // Cache persistance of every setting LLControlVariable* pSetting; for (std::map::iterator itDbg = m_DbgAllowed.begin(); itDbg != m_DbgAllowed.end(); ++itDbg) { if ( ((pSetting = gSavedSettings.getControl(itDbg->first)) != NULL) && (pSetting->isPersisted()) ) itDbg->second |= DBG_PERSIST; } } } // Checked: 2009-05-17 (RLVa-0.2.0a) bool RlvExtGetSet::onForceCommand(const LLUUID& idObj, const RlvCommand& rlvCmd, ERlvCmdRet& cmdRet) { return processCommand(idObj, rlvCmd, cmdRet); } // Checked: 2009-05-17 (RLVa-0.2.0a) bool RlvExtGetSet::onReplyCommand(const LLUUID& idObj, const RlvCommand& rlvCmd, ERlvCmdRet& cmdRet) { return processCommand(idObj, rlvCmd, cmdRet); } // Checked: 2009-12-23 (RLVa-1.1.0k) | Modified: RLVa-1.1.0k bool RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd, ERlvCmdRet& eRet) { std::string strBehaviour = rlvCmd.getBehaviour(), strGetSet, strSetting; int idxSetting = strBehaviour.find('_'); if ( (strBehaviour.length() >= 6) && (-1 != idxSetting) && ((int)strBehaviour.length() > idxSetting + 1) ) { strSetting = strBehaviour.substr(idxSetting + 1); strBehaviour.erase(idxSetting); // Get rid of "_" strGetSet = strBehaviour.substr(0, 3); strBehaviour.erase(0, 3); // Get rid of get/set if ("debug" == strBehaviour) { if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) ) { rlvSendChatReply(rlvCmd.getParam(), onGetDebug(strSetting)); eRet = RLV_RET_SUCCESS; return true; } else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) ) { if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETDEBUG, idObj)) eRet = onSetDebug(strSetting, rlvCmd.getOption()); return true; } } else if ("env" == strBehaviour) { if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) ) { rlvSendChatReply(rlvCmd.getParam(), onGetEnv(strSetting)); eRet = RLV_RET_SUCCESS; return true; } else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) ) { if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETENV, idObj)) eRet = onSetEnv(strSetting, rlvCmd.getOption()); return true; } } } else if ("setrot" == rlvCmd.getBehaviour()) { // NOTE: if