summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagent.cpp')
-rwxr-xr-xindra/newview/llagent.cpp67
1 files changed, 43 insertions, 24 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 0a63358de2..54e0375a2b 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -260,11 +260,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;
}
@@ -426,6 +424,8 @@ LLAgent::LLAgent() :
mListener.reset(new LLAgentListener(*this));
+ addParcelChangedCallback(&setCanEditParcel);
+
mMoveTimer.stop();
}
@@ -452,8 +452,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));
@@ -836,22 +834,33 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id)
}
}
+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.
@@ -879,9 +888,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
{
gSky.mVOGroundp->setRegion(regionp);
}
-
- // Notify windlight managers
- teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE);
}
else
{
@@ -903,8 +909,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());
@@ -923,15 +935,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
LLFloaterMove::sUpdateFlyingStatus();
- if (teleport)
- {
- LLEnvManagerNew::instance().onTeleport();
- }
- else
- {
- LLEnvManagerNew::instance().onRegionCrossing();
- }
-
// If the newly entered region is using server bakes, and our
// current appearance is non-baked, request appearance update from
// server.
@@ -944,6 +947,12 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
// Need to handle via callback after caps arrive.
mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::handleServerBakeRegionTransition,this,_1));
}
+
+ if (notifyRegionChange)
+ {
+ LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL;
+ mRegionChangedSignal();
+ }
}
@@ -968,6 +977,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()
//-----------------------------------------------------------------------------