Fix running, wooopsies, cached controls cannot be global static

This commit is contained in:
Lirusaito
2019-03-02 14:19:03 -05:00
parent a2bf387147
commit a619d4e82a

View File

@@ -36,8 +36,12 @@ void cmdline_printchat(const std::string& message);
namespace namespace
{ {
bool sSwimming = false; bool sSwimming = false;
const LLCachedControl<bool> sSwim(gSavedSettings, "AOSwimEnabled", false); bool enable_swim()
bool is_underwater() { return sSwim && gAgentAvatarp && gAgentAvatarp->mBelowWater; } {
static const LLCachedControl<bool> swim(gSavedSettings, "AOSwimEnabled", false);
return swim;
}
bool is_underwater() { return enable_swim() && gAgentAvatarp && gAgentAvatarp->mBelowWater; }
} }
class AONotecardCallback : public LLInventoryCallback class AONotecardCallback : public LLInventoryCallback
@@ -643,9 +647,9 @@ void LLFloaterAO::ChangeStand()
void LLFloaterAO::toggleSwim(bool underwater) void LLFloaterAO::toggleSwim(bool underwater)
{ {
const LLCachedControl<bool> enabled(gSavedSettings, "AOEnabled", false); static const LLCachedControl<bool> enabled(gSavedSettings, "AOEnabled", false);
sSwimming = underwater && sSwim; sSwimming = underwater && enable_swim();
// Don't send requests if we have the AO disabled. // Don't send requests if we have the AO disabled.
if (enabled) if (enabled)