summaryrefslogtreecommitdiff
path: root/indra/newview/llagentui.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-03-31 11:57:48 -0500
committerDave Parks <davep@lindenlab.com>2023-03-31 11:57:48 -0500
commit7d144fcb2a1b0aff1b59e378c652649c3d03e94f (patch)
treede3bfe3ce90677cc4d7ab25b8aeaf5853c009068 /indra/newview/llagentui.cpp
parent0fe09bd968b987605123e99efb2fa040a988a942 (diff)
parente4173ea5cc1ef9b1677ac87a0f7c8acbe73414ee (diff)
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview/llagentui.cpp')
-rw-r--r--indra/newview/llagentui.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 3410a37890..c19ad2ae6f 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -53,7 +53,16 @@ void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/)
LLViewerRegion *regionp = gAgent.getRegion();
if (regionp)
{
- return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
+ // Make sure coordinates are within current region
+ LLVector3d global_pos = gAgent.getPositionGlobal();
+ LLVector3d region_origin = regionp->getOriginGlobal();
+ // -1 otherwise slurl will fmod 256 to 0.
+ // And valid slurl range is supposed to be 0..255
+ F64 max_val = REGION_WIDTH_METERS - 1;
+ global_pos.mdV[VX] = llclamp(global_pos[VX], region_origin[VX], region_origin[VX] + max_val);
+ global_pos.mdV[VY] = llclamp(global_pos[VY], region_origin[VY], region_origin[VY] + max_val);
+
+ return_slurl = LLSLURL(regionp->getName(), global_pos);
}
slurl = return_slurl;
}