summaryrefslogtreecommitdiff
path: root/indra/newview/llagentui.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-12-09 20:56:00 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-12-09 20:56:10 +0200
commitf01f39afd1b43a43a9886d3146fd4ea0950459b0 (patch)
treeb7837c7c5b5d55abde5452b567a7a6be08b247ca /indra/newview/llagentui.cpp
parent3387fb48979bceb539937c97915de932e70d7520 (diff)
SL-8294 Fixed Incorrect coordinates in address bar
Example: Stepping over 183/255/22 will show position 183/1/22 of the same region
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;
}