From 0c3bd94da9ba2244613b6c1f1f0e4ce9723c46d3 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 23 Nov 2009 15:16:19 -0500
Subject: [PATCH] EXT-2435 : Advanced > Shortcuts > Fly is always ticked

Did a few lines of cleanup for code surrounding this.  Issue is still not fixed though.

--HG--
branch : avatar-pipeline
---
 indra/newview/llagent.cpp                          | 6 +++++-
 indra/newview/llagent.h                            | 2 +-
 indra/newview/skins/default/xui/en/menu_viewer.xml | 2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index fb2ecb3bede..9b3e97e8d8e 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -734,6 +734,10 @@ BOOL LLAgent::canFly()
 	return parcel->getAllowFly();
 }
 
+BOOL LLAgent::getFlying() const
+{ 
+	return mControlFlags & AGENT_CONTROL_FLY; 
+}
 
 //-----------------------------------------------------------------------------
 // setFlying()
@@ -791,7 +795,7 @@ void LLAgent::setFlying(BOOL fly)
 // static
 void LLAgent::toggleFlying()
 {
-	BOOL fly = !(gAgent.mControlFlags & AGENT_CONTROL_FLY);
+	BOOL fly = !gAgent.getFlying();
 
 	gAgent.setFlying( fly );
 	gAgent.resetView();
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 4162dfce1e5..2e95dc72be1 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -310,7 +310,7 @@ class LLAgent : public LLOldEvents::LLObservable
 	// Fly
 	//--------------------------------------------------------------------
 public:
-	BOOL			getFlying() const	{ return mControlFlags & AGENT_CONTROL_FLY; }
+	BOOL			getFlying() const;
 	void			setFlying(BOOL fly);
 	static void		toggleFlying();
 	static bool		enableFlying();
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 8ab5fb16596..2b101e90584 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -1709,6 +1709,8 @@
              layout="topleft"
              name="Fly"
              shortcut="Home">
+                <menu_item_check.on_check
+                 function="Agent.getFlying" />
                 <menu_item_check.on_click
                  function="Agent.toggleFlying" />
                 <menu_item_check.on_enable
-- 
GitLab