From 00e1701de7e4f7c49d618b1690a0066998eff3e8 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Mon, 5 Oct 2020 10:33:59 -0400 Subject: [PATCH] Clean up some rlv code to be more clear and not insanely nest ?: --- indra/newview/rlvhelper.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h index 2ddeb1a4eae..f4283689cd4 100644 --- a/indra/newview/rlvhelper.h +++ b/indra/newview/rlvhelper.h @@ -25,6 +25,8 @@ #include "rlvdefines.h" #include "rlvcommon.h" +#include "absl/strings/str_cat.h" + // ============================================================================ // Forward declarations // @@ -682,10 +684,17 @@ inline void RlvBehaviourInfo::toggleBehaviourFlag(EBehaviourFlags eBhvrFlag, boo // Checked: 2009-09-19 (RLVa-1.0.3d) inline std::string RlvCommand::asString() const { - // NOTE: @clear=<param> should be represented as clear:<param> - return (m_eParamType != RLV_TYPE_CLEAR) - ? (!m_strOption.empty()) ? (std::string(getBehaviour())).append(":").append(m_strOption) : (std::string(getBehaviour())) - : (!m_strParam.empty()) ? (std::string(getBehaviour())).append(":").append(m_strParam) : (std::string(getBehaviour())); + // NOTE: @clear=<param> should be represented as clear:<param> + std::string bhvr = getBehaviour(); + if (m_eParamType != RLV_TYPE_CLEAR && !m_strOption.empty()) + { + absl::StrAppend(&bhvr, ":", m_strOption); + } + else if (!m_strParam.empty()) + { + absl::StrAppend(&bhvr, ":", m_strParam); + } + return bhvr; } inline bool RlvCommand::operator ==(const RlvCommand& rhs) const -- GitLab