summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagent.cpp')
-rwxr-xr-xindra/newview/llagent.cpp61
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()
//-----------------------------------------------------------------------------