summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r--indra/newview/llagent.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 39d4a3fc15..5aaf9d0097 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -102,6 +102,7 @@
#include "lltoolpie.h"
#include "lltoolview.h"
#include "llui.h" // for make_ui_sound
+#include "llurldispatcher.h"
#include "llviewercamera.h"
#include "llviewerinventory.h"
#include "llviewermenu.h"
@@ -904,6 +905,24 @@ const LLHost& LLAgent::getRegionHost() const
}
}
+//-----------------------------------------------------------------------------
+// getSLURL()
+// returns empty() if getRegion() == NULL
+//-----------------------------------------------------------------------------
+std::string LLAgent::getSLURL() const
+{
+ std::string slurl;
+ LLViewerRegion *regionp = getRegion();
+ if (regionp)
+ {
+ LLVector3d agentPos = getPositionGlobal();
+ S32 x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
+ S32 y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
+ S32 z = llround( (F32)agentPos.mdV[VZ] );
+ slurl = LLURLDispatcher::buildSLURL(regionp->getName(), x, y, z);
+ }
+ return slurl;
+}
//-----------------------------------------------------------------------------
// inPrelude()
@@ -1021,7 +1040,7 @@ void LLAgent::slamLookAt(const LLVector3 &look_at)
//-----------------------------------------------------------------------------
// getPositionGlobal()
//-----------------------------------------------------------------------------
-const LLVector3d &LLAgent::getPositionGlobal()
+const LLVector3d &LLAgent::getPositionGlobal() const
{
if (!mAvatarObject.isNull() && !mAvatarObject->mDrawable.isNull())
{
@@ -5783,6 +5802,11 @@ void LLAgent::setTeleportState(ETeleportState state)
{
LLFloaterSnapshot::hide(0);
}
+ if (mTeleportState == TELEPORT_MOVING)
+ {
+ // We're outa here. Save "back" slurl.
+ mTeleportSourceSLURL = getSLURL();
+ }
}
void LLAgent::fidget()