From 1a2a25cb857044d3fa6e80d3edaf5c7a15e167a3 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Thu, 24 Jun 2010 17:38:12 -0400
Subject: [PATCH] EXT-7747 FIXED Turn on multiattachments for 2.1 as debug
 setting

This #ifdef is now keyed to MultipleAttachments debug setting
---
 indra/newview/app_settings/settings.xml | 15 +++++++++++++--
 indra/newview/llagentwearables.cpp      |  9 ++++-----
 indra/newview/llinventorybridge.cpp     | 13 ++++++-------
 indra/newview/llselectmgr.cpp           |  7 ++++---
 4 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 1d635ef18a3..d3cc5d6cb7a 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5338,7 +5338,7 @@
       <string>Boolean</string>
       <key>Value</key>
       <integer>0</integer>
-    </map>
+    </map> 
     <key>MouseSun</key>
     <map>
       <key>Comment</key>
@@ -5350,7 +5350,18 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>MuteAmbient</key>
+    <key>MultipleAttachments</key>
+    <map>
+      <key>Comment</key>
+      <string>Allow multiple objects to be attached to a single attachment point.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+   <key>MuteAmbient</key>
     <map>
       <key>Comment</key>
       <string>Ambient sound effects, such as wind noise, play at 0 volume</string>
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index bca92a60bef..e70511ce6e1 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1867,11 +1867,10 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
 		msg->nextBlockFast(_PREHASH_ObjectData );
 		msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
 		msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner());
-#if ENABLE_MULTIATTACHMENTS
-		msg->addU8Fast(_PREHASH_AttachmentPt, 0 | ATTACHMENT_ADD );
-#else
-		msg->addU8Fast(_PREHASH_AttachmentPt, 0 );	// Wear at the previous or default attachment point
-#endif
+		if (gSavedSettings.getBOOL("MultipleAttachments"))
+			msg->addU8Fast(_PREHASH_AttachmentPt, 0 | ATTACHMENT_ADD );
+		else
+			msg->addU8Fast(_PREHASH_AttachmentPt, 0 );	// Wear at the previous or default attachment point
 		pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
 		msg->addStringFast(_PREHASH_Name, item->getName());
 		msg->addStringFast(_PREHASH_Description, item->getDescription());
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index a5f24c55fe0..bc28140b75e 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -3963,13 +3963,12 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 
 	payload["attachment_point"] = attach_pt;
 
-#if !ENABLE_MULTIATTACHMENTS
-	if (attachment && attachment->getNumObjects() > 0)
+	if (!gSavedSettings.getBOOL("MultipleAttachments") &&
+		(attachment && attachment->getNumObjects() > 0))
 	{
 		LLNotificationsUtil::add("ReplaceAttachment", LLSD(), payload, confirm_replace_attachment_rez);
 	}
 	else
-#endif
 	{
 		LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/);
 	}
@@ -3992,6 +3991,10 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
 
 		if (itemp)
 		{
+			U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
+			if (gSavedSettings.getBOOL("MultipleAttachments"))
+				attachment_pt |= ATTACHMENT_ADD;
+
 			LLMessageSystem* msg = gMessageSystem;
 			msg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv);
 			msg->nextBlockFast(_PREHASH_AgentData);
@@ -4000,10 +4003,6 @@ bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& respon
 			msg->nextBlockFast(_PREHASH_ObjectData);
 			msg->addUUIDFast(_PREHASH_ItemID, itemp->getUUID());
 			msg->addUUIDFast(_PREHASH_OwnerID, itemp->getPermissions().getOwner());
-			U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
-#if ENABLE_MULTIATTACHMENTS
-			attachment_pt |= ATTACHMENT_ADD;
-#endif
 			msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt);
 			pack_permissions_slam(msg, itemp->getFlags(), itemp->getPermissions());
 			msg->addStringFast(_PREHASH_Name, itemp->getName());
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index af16b962e62..050b87bbe0f 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -3629,9 +3629,10 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
 	if (0 == attachment_point ||
 		get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
 	{
-#if ENABLE_MULTIATTACHMENTS
-		attachment_point |= ATTACHMENT_ADD;
-#endif
+
+		if (gSavedSettings.getBOOL("MultipleAttachments"))
+			attachment_point |= ATTACHMENT_ADD;
+
 		sendListToRegions(
 			"ObjectAttach",
 			packAgentIDAndSessionAndAttachment, 
-- 
GitLab