diff options
author | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2014-06-24 11:37:55 +0300 |
---|---|---|
committer | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2014-06-24 11:37:55 +0300 |
commit | 190f66ab78e6a2df15e91e80d9863dcc8f030a2c (patch) | |
tree | 375e5985d2741036efa9fff433d59645f01bde6c /indra/newview/lltoolbrush.cpp | |
parent | a23ec5ffa84c1122af3cbb416363a0eb564ad65c (diff) |
MAINT-875 FIXED Display notification if user is not allowed to terraform hovered parcel.
Diffstat (limited to 'indra/newview/lltoolbrush.cpp')
-rwxr-xr-x | indra/newview/lltoolbrush.cpp | 57 |
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 ///============================================================================ |