From ffc20ac3c32e64c177f932b55892c4b872bc7d08 Mon Sep 17 00:00:00 2001
From: Kitty Barnett <develop@catznip.com>
Date: Sat, 4 Jun 2016 15:32:38 +0200
Subject: [PATCH] Auto-pilot should be subject to local teleport restrictions

--HG--
branch : RLVa
---
 indra/newview/lltoolpie.cpp                   | 36 ++++++++++++++++---
 indra/newview/rlvdefines.h                    |  1 +
 .../skins/default/xui/en/rlva_strings.xml     |  5 +++
 3 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 0a18faed12..ad9313c136 100755
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -730,10 +730,24 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
                                              FALSE /* ignore transparent */,
                                              FALSE /* ignore particles */);
 
-        if (!mPick.mPosGlobal.isExactlyZero()			// valid coordinates for pick
-            && (mPick.mPickType == LLPickInfo::PICK_LAND	// we clicked on land
-                || mPick.mObjectID.notNull()))				// or on an object
+//        if (!mPick.mPosGlobal.isExactlyZero()			// valid coordinates for pick
+//            && (mPick.mPickType == LLPickInfo::PICK_LAND	// we clicked on land
+//                || mPick.mObjectID.notNull()))				// or on an object
+// [RLVa:KB] - Checked: RLVa-2.0.0
+		bool fValidPick = (!mPick.mPosGlobal.isExactlyZero()			// valid coordinates for pick
+			&& (mPick.mPickType == LLPickInfo::PICK_LAND	// we clicked on land
+				|| mPick.mObjectID.notNull()));				// or on an object
+
+		if ( (fValidPick) && (RlvActions::isRlvEnabled()) && (!RlvActions::canTeleportToLocal(mPick.mPosGlobal)) )
+		{
+			RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_AUTOPILOT);
+			fValidPick = false;
+		}
+
+		if (fValidPick)
+// [/RLVa:KB]
         {
+
             // handle special cases of steering picks
             LLViewerObject* avatar_object = mPick.getObject();
 
@@ -828,8 +842,20 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
             }
         }
 
-		if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) ||
-			(mPick.mObjectID.notNull()  && !mPick.mPosGlobal.isExactlyZero()))
+//		if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) ||
+//			(mPick.mObjectID.notNull()  && !mPick.mPosGlobal.isExactlyZero()))
+// [RLVa:KB] - Checked: RLVa-2.0.0
+		bool fValidPick = ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) ||
+			(mPick.mObjectID.notNull()  && !mPick.mPosGlobal.isExactlyZero()));
+
+		if ( (fValidPick) && (RlvActions::isRlvEnabled()) && (!RlvActions::canTeleportToLocal(mPick.mPosGlobal)) )
+		{
+			RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_AUTOPILOT);
+			fValidPick = false;
+		}
+
+		if (fValidPick)
+// [/RLVa:KB]
 		{
 			walkToClickedLocation();
 			return TRUE;
diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h
index 3d90218d77..d62f389e00 100644
--- a/indra/newview/rlvdefines.h
+++ b/indra/newview/rlvdefines.h
@@ -314,6 +314,7 @@ enum ERlvAttachGroupType
 #define RLV_STRING_HIDDEN_PARCEL			"hidden_parcel"
 #define RLV_STRING_HIDDEN_REGION			"hidden_region"
 
+#define RLV_STRING_BLOCKED_AUTOPILOT		"blocked_autopilot"
 #define RLV_STRING_BLOCKED_GENERIC			"blocked_generic"
 #define RLV_STRING_BLOCKED_PERMATTACH		"blocked_permattach"
 #define RLV_STRING_BLOCKED_PERMTELEPORT		"blocked_permteleport"
diff --git a/indra/newview/skins/default/xui/en/rlva_strings.xml b/indra/newview/skins/default/xui/en/rlva_strings.xml
index 0e3c27ca0a..b709981ef4 100644
--- a/indra/newview/skins/default/xui/en/rlva_strings.xml
+++ b/indra/newview/skins/default/xui/en/rlva_strings.xml
@@ -46,6 +46,11 @@
 		</map>
 
 		<!-- Shown as notifications -->
+		<key>blocked_autopilot</key>
+		<map>
+			<key>value</key>
+			<string>Unable to use the autopilot due to RLV restrictions</string>
+		</map>
 		<key>blocked_generic</key>
 		<map>
 			<key>value</key>
-- 
GitLab