From 620b125e4187501a7ca1e652506cbe4969611b82 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Fri, 4 Mar 2022 21:59:36 -0500
Subject: [PATCH] Opensim map tile support

---
 indra/newview/llstartup.cpp     | 2 ++
 indra/newview/llworldmipmap.cpp | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 19e86f05f45..04a202cd2e3 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -3444,6 +3444,8 @@ bool process_login_success_response(U32& first_sim_size_x, U32& first_sim_size_y
 	{
 		// agent_access can be 'A', 'M', and 'PG'.
 		gAgent.setMaturity(text[0]);
+		U32 preferredMaturity = (U32)LLAgent::convertTextToMaturity(text[0]);
+		gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
 	}
 	
 	// this is the value of their preference setting for that content
diff --git a/indra/newview/llworldmipmap.cpp b/indra/newview/llworldmipmap.cpp
index 040d0deaf35..28f1cc5193f 100644
--- a/indra/newview/llworldmipmap.cpp
+++ b/indra/newview/llworldmipmap.cpp
@@ -27,7 +27,9 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llworldmipmap.h"
+#include "llagent.h"
 #include "llviewercontrol.h"		// LLControlGroup
+#include "llviewerregion.h"
 
 #include "llviewertexturelist.h"
 #include "math.h"	// log()
@@ -181,7 +183,9 @@ LLPointer<LLViewerFetchedTexture> LLWorldMipmap::getObjectsTile(U32 grid_x, U32
 LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 grid_y, S32 level)
 {
 	// Get the grid coordinates
-	std::string imageurl = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y);
+	LLViewerRegion* regionp = gAgent.getRegion();
+	std::string imageurl = regionp != nullptr ? regionp->getMapServerURL() : gSavedSettings.getString("CurrentMapServerURL");
+	imageurl.append(llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y));
 
 	// DO NOT COMMIT!! DEBUG ONLY!!!
 	// Use a local jpeg for every tile to test map speed without S3 access
-- 
GitLab