From 0bd17be512fbf47600a7971208244e73424429f4 Mon Sep 17 00:00:00 2001
From: McCabe Maxsted
Date: Tue, 6 Oct 2009 22:16:12 -0700
Subject: Applied RLVa-1.0.3e_20091005_Imprudence-1.2.0-diff.patch by Kitty
Barnett
---
linden/indra/newview/rlvhelper.cpp | 374 ++++++++++++++++++-------------------
1 file changed, 181 insertions(+), 193 deletions(-)
(limited to 'linden/indra/newview/rlvhelper.cpp')
diff --git a/linden/indra/newview/rlvhelper.cpp b/linden/indra/newview/rlvhelper.cpp
index 429a527..f495384 100644
--- a/linden/indra/newview/rlvhelper.cpp
+++ b/linden/indra/newview/rlvhelper.cpp
@@ -1,5 +1,6 @@
#include "llviewerprecompiledheaders.h"
#include "llagent.h"
+#include "llfloaterwindlight.h"
#include "llviewerobject.h"
#include "llviewerstats.h"
#include "llviewerwindow.h"
@@ -14,31 +15,33 @@
// Static variable initialization
//
-RlvMultiStringSearch RlvCommand::m_BhvrLookup;
+RlvCommand::RlvBhvrTable RlvCommand::m_BhvrMap;
// ============================================================================
+// RlvCommmand
+//
-// Checked:
+// Checked: 2009-09-10 (RLVa-1.0.3a) | Modified: RLVa-1.0.3a
RlvCommand::RlvCommand(const std::string& strCommand)
: m_eBehaviour(RLV_BHVR_UNKNOWN), m_eParamType(RLV_TYPE_UNKNOWN)
{
if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam)))
{
+ S32 nTemp = 0;
if ( ("n" == m_strParam) || ("add" == m_strParam) )
m_eParamType = RLV_TYPE_ADD;
else if ( ("y" == m_strParam) || ("rem" == m_strParam) )
m_eParamType = RLV_TYPE_REMOVE;
else if ("force" == m_strParam)
m_eParamType = RLV_TYPE_FORCE;
+ else if (LLStringUtil::convertToS32(m_strParam, nTemp)) // Assume it's a reply command if we can convert to an S32
+ m_eParamType = RLV_TYPE_REPLY;
+ else if (m_strBehaviour == "clear") // clear is the odd one out so just make it its own type
+ m_eParamType = RLV_TYPE_CLEAR;
else
{
- m_eParamType = RLV_TYPE_REPLY; // Assume it's a reply command until we encounter a non-digit
-
- if ( (m_strParam.empty()) || (-1 != m_strParam.find_first_not_of("0123456789")) )
- {
- m_eParamType = RLV_TYPE_UNKNOWN;
- m_fValid = ("clear" == m_strBehaviour);
- }
+ m_eParamType = RLV_TYPE_UNKNOWN;
+ m_fValid = false;
}
}
@@ -48,50 +51,16 @@ RlvCommand::RlvCommand(const std::string& strCommand)
return;
}
- U16 nBehaviour;
- if (m_BhvrLookup.getExactMatchParam(m_strBehaviour, nBehaviour))
- {
- m_eBehaviour = (ERlvBehaviour)nBehaviour;
- }
+ RlvBhvrTable::const_iterator itBhvr = m_BhvrMap.find(m_strBehaviour);
+ if (itBhvr != m_BhvrMap.end())
+ m_eBehaviour = itBhvr->second;
}
-RlvCommand::RlvCommand(const RlvCommand& rlvCmd)
- : m_fValid(rlvCmd.m_fValid),
- m_strBehaviour(rlvCmd.m_strBehaviour), m_eBehaviour(rlvCmd.m_eBehaviour),
- m_strOption(rlvCmd.m_strOption),
- m_strParam(rlvCmd.m_strParam), m_eParamType(rlvCmd.m_eParamType)
-{
-}
-// ============================================================================
-
-/*
- * ------------------------------
- * Command | RLV | RLVa
- * ------------------------------
- * : | F | F (missing behaviour)
- * :option | F | F (missing behaviour)
- * := | T | F (missing behaviour)
- * :option= | T | F (missing behaviour)
- * :option=param | T | F (missing behaviour)
- * = | T | F (missing behaviour)
- * =param | T | F (missing behaviour)
- * cmd | F | F (missing param) [T if == "clear"]
- * cmd: | F | F (missing param)
- * cmd:option | F | F (missing param)
- * cmd:= | T | F (missing param) [1]
- * cmd:option= | T | F (missing param) [1]
- * cmd= | T | F (missing param) [1]
- * cmd:option=param | T | T
- * cmd=param | T | T
- * cmd:=param | T | T
- *
- * [1] 'clear:=', 'clear:option=' and 'clear=' are "valid" variations of 'clear'
- */
-
-BOOL RlvCommand::parseCommand(/*[in]*/ const std::string& strCommand,
- /*[out]*/ std::string& strBehaviour, /*[out]*/ std::string& strOption, /*[out]*/ std::string& strParam)
+bool RlvCommand::parseCommand(const std::string& strCommand, std::string& strBehaviour, std::string& strOption, std::string& strParam)
{
+ // (See behaviour notes for the command parsing truth table)
+
// Format: [: