From aade7752202d321eb3cf6ed6a9e004ad200689b7 Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Tue, 13 Apr 2010 08:44:34 +0300
Subject: [PATCH] Fixed normal bug EXT-6624 ('Land for sale' icon isn't showed
 in Navigation bar after teleport from another land for sale with 'Moderate'
 rating)

-       Reason: after teleport, Agent's content rate compares with just teleported Region's content rate, to check whether Agent can buy a Parcel in this Region. But it compares with old Region ones. Because In method 'LLViewerParcelMgr::canAgentBuyParcel' the call of 'LLViewerParcelMgr::getInstance()->getSelectionRegion()' returns last selected parcel. So after teleport this method call will always return old Region.
        Solution: In 'LLViewerParcelMgr::canAgentBuyParcel' determine current Parcel Agent is in, then determine Region using Agent's Parcel information and use actual Region.

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/222/

--HG--
branch : product-engine
---
 indra/newview/llviewerparcelmgr.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 1f6bbcbae86..a591cc1e143 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -2185,7 +2185,8 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const
 		return true;	// change this if want to make it gods only
 	}
 	
-	LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+	LLVector3 parcel_coord = parcel->getCenterpoint();
+	LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosAgent(parcel_coord);
 	if (regionp)
 	{
 		U8 sim_access = regionp->getSimAccess();
-- 
GitLab