summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-02-01 16:57:34 +0200
committerSergei Litovchuk <slitovchuk@productengine.com>2010-02-01 16:57:34 +0200
commita359db96eb0273bf67fe48bae2665ea65831cf67 (patch)
treed3bf44a50882699579073259b88a0cc0a6eb175e /indra/newview
parent7bcba326b32e1aca678edfb4495d1e2d4d44cb71 (diff)
(EXT-2987) Parcel Characteristics icons aren't refreshed
after changing restrictions - LLViewerParcelMgr refactoring. Changed parcel characteristics accessors to get selected parcel properties. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lllocationinputctrl.cpp14
-rw-r--r--indra/newview/llpanelplaceprofile.cpp40
-rw-r--r--indra/newview/llviewerparcelmgr.cpp36
-rw-r--r--indra/newview/llviewerparcelmgr.h12
4 files changed, 52 insertions, 50 deletions
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 0e93e28f2d..4f40a0a532 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -722,14 +722,12 @@ void LLLocationInputCtrl::refreshParcelIcons()
}
bool allow_buy = vpm->canAgentBuyParcel(current_parcel, false);
- bool allow_voice = agent_region->isVoiceEnabled() && current_parcel->getParcelFlagAllowVoice();
- bool allow_fly = !agent_region->getBlockFly() && current_parcel->getAllowFly();
- bool allow_push = !agent_region->getRestrictPushObject() && !current_parcel->getRestrictPushObject();
- bool allow_build = current_parcel->getAllowModify(); // true when anyone is allowed to build. See EXT-4610.
- bool allow_scripts = !(agent_region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) &&
- !(agent_region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) &&
- current_parcel->getAllowOtherScripts();
- bool allow_damage = agent_region->getAllowDamage() || current_parcel->getAllowDamage();
+ bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel);
+ bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel);
+ bool allow_push = vpm->allowAgentPush(agent_region, current_parcel);
+ bool allow_build = vpm->allowAgentBuild(current_parcel); // true when anyone is allowed to build. See EXT-4610.
+ bool allow_scripts = vpm->allowAgentScripts(agent_region, current_parcel);
+ bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel);
// Most icons are "block this ability"
mForSaleBtn->setVisible(allow_buy);
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 9b31ef23a2..9e5f9da0ea 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -340,8 +340,10 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
std::string on = getString("on");
std::string off = getString("off");
+ LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
+
// Processing parcel characteristics
- if (region->isVoiceEnabled() && parcel->getParcelFlagAllowVoice())
+ if (vpm->allowAgentVoice(region, parcel))
{
mVoiceIcon->setValue(icon_voice);
mVoiceText->setText(on);
@@ -352,7 +354,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
mVoiceText->setText(off);
}
- if (!region->getBlockFly() && parcel->getAllowFly())
+ if (vpm->allowAgentFly(region, parcel))
{
mFlyIcon->setValue(icon_fly);
mFlyText->setText(on);
@@ -363,18 +365,18 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
mFlyText->setText(off);
}
- if (region->getRestrictPushObject() || parcel->getRestrictPushObject())
+ if (vpm->allowAgentPush(region, parcel))
{
- mPushIcon->setValue(icon_push_no);
- mPushText->setText(off);
+ mPushIcon->setValue(icon_push);
+ mPushText->setText(on);
}
else
{
- mPushIcon->setValue(icon_push);
- mPushText->setText(on);
+ mPushIcon->setValue(icon_push_no);
+ mPushText->setText(off);
}
- if (parcel->getAllowModify())
+ if (vpm->allowAgentBuild(parcel))
{
mBuildIcon->setValue(icon_build);
mBuildText->setText(on);
@@ -385,20 +387,18 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
mBuildText->setText(off);
}
- if ((region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) ||
- (region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) ||
- !parcel->getAllowOtherScripts())
+ if (vpm->allowAgentScripts(region, parcel))
{
- mScriptsIcon->setValue(icon_scripts_no);
- mScriptsText->setText(off);
+ mScriptsIcon->setValue(icon_scripts);
+ mScriptsText->setText(on);
}
else
{
- mScriptsIcon->setValue(icon_scripts);
- mScriptsText->setText(on);
+ mScriptsIcon->setValue(icon_scripts_no);
+ mScriptsText->setText(off);
}
- if (region->getAllowDamage() || parcel->getAllowDamage())
+ if (vpm->allowAgentDamage(region, parcel))
{
mDamageIcon->setValue(icon_damage);
mDamageText->setText(on);
@@ -461,12 +461,8 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
S32 claim_price;
S32 rent_price;
F32 dwell;
- BOOL for_sale = parcel->getForSale();
- LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
- &claim_price,
- &rent_price,
- &for_sale,
- &dwell);
+ BOOL for_sale;
+ vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell);
if (for_sale)
{
const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index b85b42c710..7ec650629d 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -666,31 +666,38 @@ bool LLViewerParcelMgr::allowAgentBuild() const
}
}
+// Return whether anyone can build on the given parcel
+bool LLViewerParcelMgr::allowAgentBuild(const LLParcel* parcel) const
+{
+ return parcel->getAllowModify();
+}
+
bool LLViewerParcelMgr::allowAgentVoice() const
{
- LLViewerRegion* region = gAgent.getRegion();
+ return allowAgentVoice(gAgent.getRegion(), mAgentParcel);
+}
+
+bool LLViewerParcelMgr::allowAgentVoice(const LLViewerRegion* region, const LLParcel* parcel) const
+{
return region && region->isVoiceEnabled()
- && mAgentParcel && mAgentParcel->getParcelFlagAllowVoice();
+ && parcel && parcel->getParcelFlagAllowVoice();
}
-bool LLViewerParcelMgr::allowAgentFly() const
+bool LLViewerParcelMgr::allowAgentFly(const LLViewerRegion* region, const LLParcel* parcel) const
{
- LLViewerRegion* region = gAgent.getRegion();
return region && !region->getBlockFly()
- && mAgentParcel && mAgentParcel->getAllowFly();
+ && parcel && parcel->getAllowFly();
}
// Can the agent be pushed around by LLPushObject?
-bool LLViewerParcelMgr::allowAgentPush() const
+bool LLViewerParcelMgr::allowAgentPush(const LLViewerRegion* region, const LLParcel* parcel) const
{
- LLViewerRegion* region = gAgent.getRegion();
return region && !region->getRestrictPushObject()
- && mAgentParcel && !mAgentParcel->getRestrictPushObject();
+ && parcel && !parcel->getRestrictPushObject();
}
-bool LLViewerParcelMgr::allowAgentScripts() const
+bool LLViewerParcelMgr::allowAgentScripts(const LLViewerRegion* region, const LLParcel* parcel) const
{
- LLViewerRegion* region = gAgent.getRegion();
// *NOTE: This code does not take into account group-owned parcels
// and the flag to allow group-owned scripted objects to run.
// This mirrors the traditional menu bar parcel icon code, but is not
@@ -698,15 +705,14 @@ bool LLViewerParcelMgr::allowAgentScripts() const
return region
&& !(region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS)
&& !(region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS)
- && mAgentParcel
- && mAgentParcel->getAllowOtherScripts();
+ && parcel
+ && parcel->getAllowOtherScripts();
}
-bool LLViewerParcelMgr::allowAgentDamage() const
+bool LLViewerParcelMgr::allowAgentDamage(const LLViewerRegion* region, const LLParcel* parcel) const
{
- LLViewerRegion* region = gAgent.getRegion();
return (region && region->getAllowDamage())
- || (mAgentParcel && mAgentParcel->getAllowDamage());
+ || (parcel && parcel->getAllowDamage());
}
BOOL LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index 379190789b..98be8e2c7b 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -171,26 +171,28 @@ public:
// Can this agent build on the parcel he is on?
// Used for parcel property icons in nav bar.
bool allowAgentBuild() const;
+ bool allowAgentBuild(const LLParcel* parcel) const;
// Can this agent speak on the parcel he is on?
// Used for parcel property icons in nav bar.
bool allowAgentVoice() const;
-
+ bool allowAgentVoice(const LLViewerRegion* region, const LLParcel* parcel) const;
+
// Can this agent start flying on this parcel?
// Used for parcel property icons in nav bar.
- bool allowAgentFly() const;
+ bool allowAgentFly(const LLViewerRegion* region, const LLParcel* parcel) const;
// Can this agent be pushed by llPushObject() on this parcel?
// Used for parcel property icons in nav bar.
- bool allowAgentPush() const;
+ bool allowAgentPush(const LLViewerRegion* region, const LLParcel* parcel) const;
// Can scripts written by non-parcel-owners run on the agent's current
// parcel? Used for parcel property icons in nav bar.
- bool allowAgentScripts() const;
+ bool allowAgentScripts(const LLViewerRegion* region, const LLParcel* parcel) const;
// Can the agent be damaged here?
// Used for parcel property icons in nav bar.
- bool allowAgentDamage() const;
+ bool allowAgentDamage(const LLViewerRegion* region, const LLParcel* parcel) const;
F32 getHoverParcelWidth() const
{ return F32(mHoverEastNorth.mdV[VX] - mHoverWestSouth.mdV[VX]); }