summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolbrush.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2014-11-05 10:52:23 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2014-11-05 10:52:23 -0500
commit13b4909a3ca066105695afc174642409daa46df2 (patch)
treef12b1c2d32fda122bcd1f6f79ebfe2226325d9a8 /indra/newview/lltoolbrush.cpp
parent52ed6ac28697ffcfd7300602aec34db8eafc171a (diff)
parent02e2235277a90f2e291557a429ae4e5de3e0d3b6 (diff)
merge
Diffstat (limited to 'indra/newview/lltoolbrush.cpp')
-rwxr-xr-xindra/newview/lltoolbrush.cpp57
1 files changed, 50 insertions, 7 deletions
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index 56f0f8be25..e3eb8ba7af 100755
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -52,7 +52,7 @@
#include "llworld.h"
#include "llappviewer.h"
#include "llparcel.h"
-
+#include "roles_constants.h"
#include "llglheaders.h"
const std::string REGION_BLOCKS_TERRAFORM_MSG = "This region does not allow terraforming.\n"
@@ -239,9 +239,9 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
iter != mLastAffectedRegions.end(); ++iter)
{
LLViewerRegion* regionp = *iter;
- if (!canTerraform(regionp))
+ if (!canTerraformRegion(regionp))
{
- alertNoTerraform(regionp);
+ alertNoTerraformRegion(regionp);
return;
}
}
@@ -376,12 +376,17 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask)
LLRegionPosition region_position( spot );
LLViewerRegion* regionp = region_position.getRegion();
- if (!canTerraform(regionp))
+ if (!canTerraformRegion(regionp))
{
- alertNoTerraform(regionp);
+ alertNoTerraformRegion(regionp);
return TRUE;
}
+ if (!canTerraformParcel(regionp))
+ {
+ alertNoTerraformParcel();
+ }
+
LLVector3 pos_region = region_position.getPositionRegion();
U32 grids = regionp->getLand().mGridsPerEdge;
S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids );
@@ -408,6 +413,16 @@ BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask )
mMouseY = y;
mGotHover = TRUE;
gViewerWindow->setCursor(UI_CURSOR_TOOLLAND);
+
+ LLVector3d spot;
+ if( gViewerWindow->mousePointOnLandGlobal( mMouseX, mMouseY, &spot ) )
+ {
+
+ spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
+ spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
+
+ LLViewerParcelMgr::getInstance()->setHoverParcel(spot);
+ }
return TRUE;
}
@@ -653,7 +668,7 @@ void LLToolBrushLand::redo()
}*/
// static
-bool LLToolBrushLand::canTerraform(LLViewerRegion* regionp) const
+bool LLToolBrushLand::canTerraformRegion(LLViewerRegion* regionp) const
{
if (!regionp) return false;
if (regionp->canManageEstate()) return true;
@@ -661,7 +676,22 @@ bool LLToolBrushLand::canTerraform(LLViewerRegion* regionp) const
}
// static
-void LLToolBrushLand::alertNoTerraform(LLViewerRegion* regionp)
+bool LLToolBrushLand::canTerraformParcel(LLViewerRegion* regionp) const
+{
+ LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
+ bool is_terraform_allowed = false;
+ if (selected_parcel)
+ {
+ BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(selected_parcel, GP_LAND_ALLOW_EDIT_LAND);
+ is_terraform_allowed = ( gAgent.canManageEstate() || (selected_parcel->getOwnerID() == regionp->getOwner()) || owner_release);
+ }
+
+ return is_terraform_allowed;
+}
+
+
+// static
+void LLToolBrushLand::alertNoTerraformRegion(LLViewerRegion* regionp)
{
if (!regionp) return;
@@ -671,6 +701,19 @@ void LLToolBrushLand::alertNoTerraform(LLViewerRegion* regionp)
}
+// static
+void LLToolBrushLand::alertNoTerraformParcel()
+{
+ LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
+ if (selected_parcel)
+ {
+ LLSD args;
+ args["PARCEL"] = selected_parcel->getName();
+ LLNotificationsUtil::add("ParcelNoTerraforming", args);
+ }
+
+}
+
///============================================================================
/// Local function definitions
///============================================================================