diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-02-11 16:04:31 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-02-11 16:04:31 -0500 |
commit | 969cb45920c568aeebf145480b7beacb2a157bcf (patch) | |
tree | 63dfb29d5e0226b054094d88358bec6ede68c197 /indra/newview/llagent.cpp | |
parent | d8f627d8bd45cc356583e2251500c23bed836b16 (diff) | |
parent | 413be91cf5044889ade97dcbec4b17fceff122e3 (diff) |
merge
Diffstat (limited to 'indra/newview/llagent.cpp')
-rwxr-xr-x | indra/newview/llagent.cpp | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index ba81f75683..66d33d938f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -259,11 +259,9 @@ bool handleSlowMotionAnimation(const LLSD& newvalue) return true; } -// static -void LLAgent::parcelChangedCallback() +void LLAgent::setCanEditParcel() // called via mParcelChangedSignal { bool can_edit = LLToolMgr::getInstance()->canEdit(); - gAgent.mCanEditParcel = can_edit; } @@ -425,6 +423,8 @@ LLAgent::LLAgent() : mListener.reset(new LLAgentListener(*this)); + addParcelChangedCallback(&setCanEditParcel); + mMoveTimer.stop(); } @@ -451,8 +451,6 @@ void LLAgent::init() mLastKnownRequestMaturity = mLastKnownResponseMaturity; mIsDoSendMaturityPreferenceToServer = true; - LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback)); - if (!mTeleportFinishedSlot.connected()) { mTeleportFinishedSlot = LLViewerParcelMgr::getInstance()->setTeleportFinishedCallback(boost::bind(&LLAgent::handleTeleportFinished, this)); @@ -812,22 +810,33 @@ void LLAgent::standUp() } +void LLAgent::changeParcels() +{ + LL_DEBUGS("AgentLocation") << "Calling ParcelChanged callbacks" << LL_ENDL; + // Notify anything that wants to know about parcel changes + mParcelChangedSignal(); +} + +boost::signals2::connection LLAgent::addParcelChangedCallback(parcel_changed_callback_t cb) +{ + return mParcelChangedSignal.connect(cb); +} + //----------------------------------------------------------------------------- // setRegion() //----------------------------------------------------------------------------- void LLAgent::setRegion(LLViewerRegion *regionp) { - bool teleport = true; - + bool notifyRegionChange; + llassert(regionp); if (mRegionp != regionp) { - // std::string host_name; - // host_name = regionp->getHost().getHostName(); - + notifyRegionChange = true; + std::string ip = regionp->getHost().getString(); - llinfos << "Moving agent into region: " << regionp->getName() - << " located at " << ip << llendl; + LL_INFOS("AgentLocation") << "Moving agent into region: " << regionp->getName() + << " located at " << ip << LL_ENDL; if (mRegionp) { // We've changed regions, we're now going to change our agent coordinate frame. @@ -855,9 +864,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp) { gSky.mVOGroundp->setRegion(regionp); } - - // Notify windlight managers - teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE); } else { @@ -879,8 +885,14 @@ void LLAgent::setRegion(LLViewerRegion *regionp) // Pass new region along to metrics components that care about this level of detail. LLAppViewer::metricsUpdateRegion(regionp->getHandle()); } + else + { + notifyRegionChange = false; + } mRegionp = regionp; + // TODO - most of what follows probably should be moved into callbacks + // Pass the region host to LLUrlEntryParcel to resolve parcel name // with a server request. LLUrlEntryParcel::setRegionHost(getRegionHost()); @@ -899,13 +911,10 @@ void LLAgent::setRegion(LLViewerRegion *regionp) LLFloaterMove::sUpdateFlyingStatus(); - if (teleport) - { - LLEnvManagerNew::instance().onTeleport(); - } - else + if (notifyRegionChange) { - LLEnvManagerNew::instance().onRegionCrossing(); + LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL; + mRegionChangedSignal(); } } @@ -931,6 +940,16 @@ LLHost LLAgent::getRegionHost() const } } +boost::signals2::connection LLAgent::addRegionChangedCallback(const region_changed_signal_t::slot_type& cb) +{ + return mRegionChangedSignal.connect(cb); +} + +void LLAgent::removeRegionChangedCallback(boost::signals2::connection callback) +{ + mRegionChangedSignal.disconnect(callback); +} + //----------------------------------------------------------------------------- // inPrelude() //----------------------------------------------------------------------------- |