summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-07-29 19:37:35 +0800
committerErik Kundiman <erik@megapahit.org>2025-07-30 08:35:12 +0800
commit7cdce09bda9ff18bd02e22ddbe1b3fe95b204192 (patch)
treed29d5b5de1daca1e2284113f9c76d672ce611ec2 /indra/newview/llappviewer.cpp
parentb7d33485406150bf466f61477cfd33d9bdacb705 (diff)
Cache bool setting retrievals in updateDiscordActivity
As suggested by Andrey Kleschev. getBOOL and getF32 are expensive, so using `static LLCachedControl<>` is the way to do it in llappviewer.cpp.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index b5175fbf71..fee2a742f5 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -5994,7 +5994,8 @@ void LLAppViewer::updateDiscordActivity()
return;
}
- if (gSavedSettings.getBOOL("ShowDiscordActivityDetails"))
+ static LLCachedControl<bool> show_details(gSavedSettings, "ShowDiscordActivityDetails", false);
+ if (show_details)
{
LLAvatarName av_name;
LLAvatarNameCache::get(gAgent.getID(), &av_name);
@@ -6005,7 +6006,8 @@ void LLAppViewer::updateDiscordActivity()
activity.SetDetails(name);
}
- if (gSavedSettings.getBOOL("ShowDiscordActivityState"))
+ static LLCachedControl<bool> show_state(gSavedSettings, "ShowDiscordActivityState", false);
+ if (show_state)
{
auto agent_pos_region = gAgent.getPositionAgent();
S32 pos_x = S32(agent_pos_region.mV[VX] + 0.5f);
@@ -6033,7 +6035,8 @@ void LLAppViewer::updateDiscordActivity()
uuid_vec_t chat_radius_uuids, near_me_uuids;
auto position = gAgent.getPositionGlobal();
world->getAvatars(&chat_radius_uuids, NULL, position, CHAT_NORMAL_RADIUS);
- world->getAvatars(&near_me_uuids, NULL, position, gSavedSettings.getF32("MPVNearMeRange"));
+ static LLCachedControl<F32> range(gSavedSettings, "MPVNearMeRange", 4096.0f);
+ world->getAvatars(&near_me_uuids, NULL, position, range);
discordpp::ActivityParty party;
party.SetId(location);
party.SetCurrentSize(chat_radius_uuids.size());