From e4f327e747e3577420955fdea58bed629aca4fe6 Mon Sep 17 00:00:00 2001
From: Kitty Barnett <develop@catznip.com>
Date: Fri, 24 Jun 2016 16:58:17 +0200
Subject: [PATCH] Code cleanup: integrate some of the Firestorm changes/fixes
 so we don't wipe them out again

--HG--
branch : RLVa
---
 indra/newview/rlvcommon.cpp     |  2 +-
 indra/newview/rlvdefines.h      |  2 +-
 indra/newview/rlvextensions.cpp |  2 +-
 indra/newview/rlvhandler.cpp    |  2 +-
 indra/newview/rlvinventory.cpp  | 22 ++++++++++++++++++++++
 indra/newview/rlvinventory.h    |  8 ++++++++
 6 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp
index 8db5b32841..66ecbf4a84 100644
--- a/indra/newview/rlvcommon.cpp
+++ b/indra/newview/rlvcommon.cpp
@@ -242,7 +242,7 @@ void RlvStrings::saveToFile(const std::string& strFilePath)
 			sdStrings[itString->first]["value"] = listValues.back();
 	}
 
-	llofstream fileStream(strFilePath);
+	llofstream fileStream(strFilePath.c_str());
 	if (!fileStream.good())
 		return;
 
diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h
index 9d7ceec8bf..7c6c7a125a 100644
--- a/indra/newview/rlvdefines.h
+++ b/indra/newview/rlvdefines.h
@@ -73,7 +73,7 @@ const S32 RLVa_VERSION_BUILD = 0;
 #define RLV_PUTINV_PREFIX				"#RLV/~"
 #define RLV_PUTINV_SEPARATOR			"/"
 #define RLV_PUTINV_MAXDEPTH				4
-#define RLV_SETROT_OFFSET				F_PI_BY_TWO		// @setrot is off by 90° with the rest of SL
+#define RLV_SETROT_OFFSET				F_PI_BY_TWO		// @setrot is off by 90 degrees with the rest of SL
 #define RLV_STRINGS_FILE				"rlva_strings.xml"
 
 #define RLV_FOLDER_FLAG_NOSTRIP			"nostrip"
diff --git a/indra/newview/rlvextensions.cpp b/indra/newview/rlvextensions.cpp
index d62b353c06..43a5f61f50 100644
--- a/indra/newview/rlvextensions.cpp
+++ b/indra/newview/rlvextensions.cpp
@@ -281,7 +281,7 @@ bool RlvWindLight::setValue(const std::string& strRlvName, const std::string& st
 		}
 		else
 		{
-			pEnvMgr->useRegionSettings();
+			pEnvMgr->setUserPrefs(pEnvMgr->getWaterPresetName(), pEnvMgr->getSkyPresetName(), pEnvMgr->getDayCycleName(), false, true);
 		}
 		return true;
 	}
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp
index d162dc4bcc..54b9470ac6 100644
--- a/indra/newview/rlvhandler.cpp
+++ b/indra/newview/rlvhandler.cpp
@@ -2086,7 +2086,7 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const
 					nValue += rlvCmdOption.m_nPelvisToFootOffset;
 					if (gAgentAvatarp->getRegion()->avatarHoverHeightEnabled())
 					{
-						LLVector3 avOffset(0.0, 0.0, llclamp<F32>(nValue, MIN_HOVER_Z, MAX_HOVER_Z));
+						LLVector3 avOffset(0.0f, 0.0f, llclamp<F32>(nValue, MIN_HOVER_Z, MAX_HOVER_Z));
 						gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ", avOffset.mV[VZ]);
 						gAgentAvatarp->setHoverOffset(avOffset, true);
 					}
diff --git a/indra/newview/rlvinventory.cpp b/indra/newview/rlvinventory.cpp
index 180ddecd02..082cc6065b 100644
--- a/indra/newview/rlvinventory.cpp
+++ b/indra/newview/rlvinventory.cpp
@@ -19,6 +19,7 @@
 #include "llappearancemgr.h"
 #include "llstartup.h"
 #include "llviewerfoldertype.h"
+#include "llviewermessage.h"
 
 #include "rlvinventory.h"
 
@@ -364,6 +365,27 @@ S32 RlvInventory::getDirectDescendentsItemCount(const LLInventoryCategory* pFold
 	return cntType;
 }
 
+// Checked: 2012-11-28 (RLVa-1.4.8)
+bool RlvInventory::isGiveToRLVOffer(const LLOfferInfo& offerInfo)
+{
+	if ( (!RlvSettings::getForbidGiveToRLV()) && (RlvInventory::instance().getSharedRoot()) )
+	{
+		if (offerInfo.mFromObject)
+		{
+			return 
+				(IM_TASK_INVENTORY_OFFERED == offerInfo.mIM) && 
+				(LLAssetType::AT_CATEGORY == offerInfo.mType) && (offerInfo.mDesc.find(RLV_PUTINV_PREFIX) == 1);
+		}
+		else
+		{
+			return
+				(IM_INVENTORY_OFFERED == offerInfo.mIM) && 
+				(LLAssetType::AT_CATEGORY == offerInfo.mType) && (offerInfo.mDesc.find(RLV_PUTINV_PREFIX) == 0);
+		}
+	}
+	return false;
+}
+
 // ============================================================================
 // RlvRenameOnWearObserver member functions
 //
diff --git a/indra/newview/rlvinventory.h b/indra/newview/rlvinventory.h
index cacc9394c0..c0ae7de4d8 100644
--- a/indra/newview/rlvinventory.h
+++ b/indra/newview/rlvinventory.h
@@ -24,6 +24,12 @@
 #include "rlvhelper.h"
 #include "rlvlocks.h"
 
+// ============================================================================
+// Forward declarations
+//
+
+class LLOfferInfo;
+
 // ============================================================================
 // RlvInventory class declaration
 //
@@ -60,6 +66,8 @@ public:
 	std::string					getSharedPath(const LLUUID& idFolder) const;
 	// Returns TRUE if the supplied folder is a descendent of the #RLV folder
 	bool						isSharedFolder(const LLUUID& idFolder);
+	// Returns TRUE if the inventory offer is a "give to #RLV" offer
+	bool						isGiveToRLVOffer(const LLOfferInfo& offerInfo);
 
 	/*
 	 * Inventory fetching
-- 
GitLab