diff options
Diffstat (limited to 'indra/newview/llviewerparcelmgr.cpp')
-rw-r--r-- | indra/newview/llviewerparcelmgr.cpp | 77 |
1 files changed, 71 insertions, 6 deletions
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index d91d0abb99..e197591ef8 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -70,6 +70,8 @@ #include "llvieweraudio.h" #include "llcorehttputil.h" +#include "llenvironment.h" + const F32 PARCEL_COLLISION_DRAW_SECS = 1.f; @@ -646,6 +648,31 @@ LLParcel *LLViewerParcelMgr::getAgentParcel() const return mAgentParcel; } + +LLParcel * LLViewerParcelMgr::getAgentOrSelectedParcel() const +{ + LLParcel *parcel(nullptr); + + LLParcelSelectionHandle sel_handle(getFloatingParcelSelection()); + if (sel_handle) + { + LLParcelSelection *selection(sel_handle.get()); + if (selection) + { + parcel = selection->getParcel(); + if (parcel && (parcel->getLocalID() == INVALID_PARCEL_ID)) + { + parcel = NULL; + } + } + } + + if (!parcel) + parcel = LLViewerParcelMgr::instance().getAgentParcel(); + + return parcel; +} + // Return whether the agent can build on the land they are on bool LLViewerParcelMgr::allowAgentBuild() const { @@ -1286,6 +1313,13 @@ const std::string& LLViewerParcelMgr::getAgentParcelName() const } +const S32 LLViewerParcelMgr::getAgentParcelId() const +{ + if (mAgentParcel) + return mAgentParcel->getLocalID(); + return INVALID_PARCEL_ID; +} + void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region) { if(!parcel) @@ -1516,6 +1550,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use BOOL region_deny_transacted_override = false; // Deprecated BOOL region_deny_age_unverified_override = false; BOOL region_allow_access_override = true; + BOOL region_allow_environment_override = true; + S32 parcel_environment_version = 0; BOOL agent_parcel_update = false; // updating previous(existing) agent parcel S32 other_clean_time = 0; @@ -1606,6 +1642,12 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use msg->getBOOLFast(_PREHASH_RegionAllowAccessBlock, _PREHASH_RegionAllowAccessOverride, region_allow_access_override); } + if (msg->getNumberOfBlocks(_PREHASH_ParcelEnvironmentBlock)) + { + msg->getS32Fast(_PREHASH_ParcelEnvironmentBlock, _PREHASH_ParcelEnvironmentVersion, parcel_environment_version); + msg->getBOOLFast(_PREHASH_ParcelEnvironmentBlock, _PREHASH_RegionAllowEnvironmentOverride, region_allow_environment_override); + } + msg->getS32("ParcelData", "OtherCleanTime", other_clean_time ); LL_DEBUGS("ParcelMgr") << "Processing parcel " << local_id << " update, target(sequence): " << sequence_id << LL_ENDL; @@ -1625,6 +1667,9 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } } + S32 cur_parcel_environment_version = parcel->getParcelEnvironmentVersion(); + bool environment_changed = (cur_parcel_environment_version != parcel_environment_version); + parcel->init(owner_id, FALSE, FALSE, FALSE, claim_date, claim_price_per_meter, rent_price_per_meter, @@ -1650,6 +1695,9 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use parcel->setRegionDenyAnonymousOverride(region_deny_anonymous_override); parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override); parcel->setRegionAllowAccessOverride(region_allow_access_override); + parcel->setParcelEnvironmentVersion(cur_parcel_environment_version); + parcel->setRegionAllowEnvironmentOverride(region_allow_environment_override); + parcel->unpackMessage(msg); if (parcel == parcel_mgr.mAgentParcel) @@ -1683,12 +1731,23 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use instance->mTeleportFinishedSignal(instance->mTeleportInProgressPosition, false); } } - } - else if (agent_parcel_update) - { - // updated agent parcel - parcel_mgr.mAgentParcel->unpackMessage(msg); - } + parcel->setParcelEnvironmentVersion(parcel_environment_version); + LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + // Notify anything that wants to know when the agent changes parcels + gAgent.changeParcels(); + instance->mTeleportInProgress = FALSE; + } + else if (agent_parcel_update) + { + parcel->setParcelEnvironmentVersion(parcel_environment_version); + // updated agent parcel + parcel_mgr.mAgentParcel->unpackMessage(msg); + if ((LLEnvironment::instance().isExtendedEnvironmentEnabled() && environment_changed)) + { + LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + LLEnvironment::instance().requestParcel(local_id); + } + } } // Handle updating selections, if necessary. @@ -2616,3 +2675,9 @@ void LLViewerParcelMgr::onTeleportFailed() { mTeleportFailedSignal(); } + +bool LLViewerParcelMgr::getTeleportInProgress() +{ + return mTeleportInProgress // case where parcel data arrives after teleport + || gAgent.getTeleportState() > LLAgent::TELEPORT_NONE; // For LOCAL, no mTeleportInProgress +} |