summaryrefslogtreecommitdiff
path: root/indra/newview/llslurl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llslurl.cpp')
-rw-r--r--indra/newview/llslurl.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index f6c4710d60..836fe9729d 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -114,15 +114,19 @@ std::string LLSLURL::buildUnescapedSLURL(const std::string& regionname, S32 x, S
// static
std::string LLSLURL::buildSLURLfromPosGlobal(const std::string& regionname,
- const LLVector3d& global_pos)
+ const LLVector3d& global_pos,
+ bool escaped /*= true*/)
{
- F32 region_x = (F32)fmod(global_pos.mdV[VX], (F64)REGION_WIDTH_METERS);
- F32 region_y = (F32)fmod(global_pos.mdV[VY], (F64)REGION_WIDTH_METERS);
-
- return buildSLURL(regionname,
- llround(region_x),
- llround(region_y),
- llround((F32)global_pos.mdV[VZ]));
+ S32 x, y, z;
+ globalPosToXYZ(global_pos, x, y, z);
+ if(escaped)
+ {
+ return buildSLURL(regionname, x, y, z);
+ }
+ else
+ {
+ return buildUnescapedSLURL(regionname, x, y, z);
+ }
}
// static
@@ -132,3 +136,10 @@ bool LLSLURL::matchPrefix(const std::string& url, const std::string& prefix)
LLStringUtil::toLower(test_prefix);
return test_prefix == prefix;
}
+
+void LLSLURL::globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z)
+{
+ x = llround((F32)fmod(pos.mdV[VX], (F64)REGION_WIDTH_METERS));
+ y = llround((F32)fmod(pos.mdV[VY], (F64)REGION_WIDTH_METERS));
+ z = llround((F32)pos.mdV[VZ]);
+}