From d101f0a74ac18f5da4e7a35b1276a70a90f4e4d6 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Wed, 19 Feb 2020 04:12:24 -0500
Subject: [PATCH] Cache some settings

---
 indra/newview/llmanipscale.cpp       | 7 ++++---
 indra/newview/lltoolpie.cpp          | 3 ++-
 indra/newview/llviewerobjectlist.cpp | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 23225bfec4..d015c09d31 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -1760,7 +1760,8 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
 		start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1));
 		stop_tick = llmin(max_ticks1, num_ticks_per_side1);
 
-		F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f);
+		static const LLCachedControl<F32> grid_resolution_setting(gSavedSettings, "GridResolution");
+		F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax((F32)grid_resolution_setting, 0.001f);
 		S32 label_sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1  * 32.f) / smallest_subdivision1);
 		S32 label_sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2  * 32.f) / smallest_subdivision2);
 
@@ -1787,7 +1788,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
 				F32 tick_value;
 				if (grid_mode == GRID_MODE_WORLD)
 				{
-					tick_value = (grid_multiple1 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
+					tick_value = (grid_multiple1 + i) / (sGridMaxSubdivisionLevel / (F32)grid_resolution);
 				}
 				else
 				{
@@ -1834,7 +1835,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
 					F32 tick_value;
 					if (grid_mode == GRID_MODE_WORLD)
 					{
-						tick_value = (grid_multiple2 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
+						tick_value = (grid_multiple2 + i) / (sGridMaxSubdivisionLevel / (F32)grid_resolution);
 					}
 					else
 					{
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 63256961b6..677df6771e 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -930,7 +930,8 @@ static bool needs_tooltip(LLSelectNode* nodep)
 BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg)
 {
 	//  Do not show hover for land unless prefs are set to allow it. 
-	if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return TRUE; 
+	static LLCachedControl<bool> show_land_hovetips(gSavedSettings, "ShowLandHoverTip");
+	if (!show_land_hovetips) return TRUE;
 
     LLViewerParcelMgr::getInstance()->setHoverParcel( mHoverPick.mPosGlobal );
 
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 5ff9b4e1d9..e69aa97c0b 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1782,7 +1782,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
 	static LLUIColor physical_object_color(LLUIColorTable::instance().getColor("NetMapPhysicalObject"));
 	static LLUIColor temp_object_color(LLUIColorTable::instance().getColor("NetMapTempObject"));
 
-	static LLCachedControl<F32> max_radius(gSavedSettings, "MiniMapPrimMaxRadius");
+	static const LLCachedControl<F32> max_radius(gSavedSettings, "MiniMapPrimMaxRadius");
 
 	const vobj_list_t::const_iterator end_it = mMapObjects.cend();
 	for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != end_it; ++iter)
-- 
GitLab