diff options
author | Rider Linden <rider@lindenlab.com> | 2018-01-16 11:03:26 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-01-16 11:03:26 -0800 |
commit | a0c228d84240a80437b63e0a2cd1cee24e8004a0 (patch) | |
tree | 76cd50d1e2bdca458af102c4cfd4a32d478a1f4d /indra/newview/llenvironment.cpp | |
parent | 8211f57205f0008d8ffb9bfcd465ca26d906e19c (diff) |
MAINT-8052: Report if the returned environment is the default.
Diffstat (limited to 'indra/newview/llenvironment.cpp')
-rw-r--r-- | indra/newview/llenvironment.cpp | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index e14265d950..b05c9ee871 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -41,6 +41,9 @@ #include "llviewershadermgr.h" +#include "llparcel.h" +#include "llviewerparcelmgr.h" + #include "llsdserialize.h" #include "lldiriterator.h" @@ -106,6 +109,7 @@ void LLEnvironment::initSingleton() requestRegionEnvironment(); gAgent.addRegionChangedCallback(boost::bind(&LLEnvironment::onRegionChange, this)); + gAgent.addParcelChangedCallback(boost::bind(&LLEnvironment::onParcelChange, this)); } LLEnvironment::~LLEnvironment() @@ -143,12 +147,24 @@ LLEnvironment::connection_t LLEnvironment::setDayCycleListChange(const LLEnviron return mDayCycleListChange.connect(cb); } - void LLEnvironment::onRegionChange() { requestRegionEnvironment(); } +void LLEnvironment::onParcelChange() +{ + LLUUID parcel_id; + LLParcel* parcel = LLViewerParcelMgr::instance().getAgentParcel(); + + if (parcel) + { + parcel_id = parcel->getID(); + } + + requestParcel(parcel_id); +} + void LLEnvironment::requestRegionEnvironment() { // LLEnvironmentRequest::initiate(); @@ -821,7 +837,8 @@ void LLEnvironment::requestParcel(const LLUUID &parcel_id) { std::string coroname = LLCoros::instance().launch("LLEnvironment::coroRequestEnvironment", - boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id)); + boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id, + boost::bind(&LLEnvironment::applyEnvironment, this, _1))); } @@ -829,7 +846,9 @@ void LLEnvironment::updateParcel(const LLUUID &parcel_id, LLSettingsDay::ptr_t & { std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", - boost::bind(&LLEnvironment::coroUpdateEnvironment, this, parcel_id, pday, day_length, day_offset)); + boost::bind(&LLEnvironment::coroUpdateEnvironment, this, parcel_id, + pday, day_length, day_offset, + boost::bind(&LLEnvironment::applyEnvironment, this, _1))); } @@ -837,11 +856,11 @@ void LLEnvironment::resetParcel(const LLUUID &parcel_id) { std::string coroname = LLCoros::instance().launch("LLEnvironment::coroResetEnvironment", - boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id)); - + boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id, + boost::bind(&LLEnvironment::applyEnvironment, this, _1))); } -void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id) +void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id, environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -875,9 +894,9 @@ void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id) else { LLSD environment = result["environment"]; - if (environment.isDefined()) + if (environment.isDefined() && !apply.empty()) { - applyEnvironment(environment); + apply(environment); } } @@ -888,7 +907,7 @@ void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id) } } -void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset) +void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset, environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -932,9 +951,9 @@ void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t else { LLSD environment = result["environment"]; - if (environment.isDefined()) + if (environment.isDefined() && !apply.empty()) { - applyEnvironment(environment); + apply(environment); } } @@ -945,7 +964,7 @@ void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t } } -void LLEnvironment::coroResetEnvironment(LLUUID parcel_id) +void LLEnvironment::coroResetEnvironment(LLUUID parcel_id, environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -979,10 +998,10 @@ void LLEnvironment::coroResetEnvironment(LLUUID parcel_id) else { LLSD environment = result["environment"]; - if (environment.isDefined()) + if (environment.isDefined() && !apply.empty()) { - applyEnvironment(environment); - } + apply(environment); + } } if (!notify.isUndefined()) |