summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-01-29 20:49:54 +0200
committerSergei Litovchuk <slitovchuk@productengine.com>2010-01-29 20:49:54 +0200
commit6453d6d1ddc48f9e69ad45d6bba33fa9b2be76de (patch)
tree1a3144658c250fbd6f7aa0b80a80d89f9199ddf6 /indra
parent3e76862aaa0852d5fd34e2321c69c67df41b5f67 (diff)
Fixed low bug (EXT-2987) Parcel Characteristics icons aren't refreshed after changing restrictions
- Added updating Parcel Characteristics icons in Location Input Control upon processing parcel properties. --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lllocationinputctrl.cpp67
-rw-r--r--indra/newview/lllocationinputctrl.h3
2 files changed, 61 insertions, 9 deletions
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 050cfcc3d9..0e93e28f2d 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -153,6 +153,23 @@ private:
LLLocationInputCtrl* mInput;
};
+class LLParcelChangeObserver : public LLParcelObserver
+{
+public:
+ LLParcelChangeObserver(LLLocationInputCtrl* input) : mInput(input) {}
+
+private:
+ /*virtual*/ void changed()
+ {
+ if (mInput)
+ {
+ mInput->refreshParcelIcons();
+ }
+ }
+
+ LLLocationInputCtrl* mInput;
+};
+
//============================================================================
@@ -335,7 +352,10 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
mAddLandmarkObserver = new LLAddLandmarkObserver(this);
gInventory.addObserver(mRemoveLandmarkObserver);
gInventory.addObserver(mAddLandmarkObserver);
-
+
+ mParcelChangeObserver = new LLParcelChangeObserver(this);
+ LLViewerParcelMgr::getInstance()->addObserver(mParcelChangeObserver);
+
mAddLandmarkTooltip = LLTrans::getString("LocationCtrlAddLandmarkTooltip");
mEditLandmarkTooltip = LLTrans::getString("LocationCtrlEditLandmarkTooltip");
getChild<LLView>("Location History")->setToolTip(LLTrans::getString("LocationCtrlComboBtnTooltip"));
@@ -349,6 +369,9 @@ LLLocationInputCtrl::~LLLocationInputCtrl()
delete mRemoveLandmarkObserver;
delete mAddLandmarkObserver;
+ LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangeObserver);
+ delete mParcelChangeObserver;
+
mParcelMgrConnection.disconnect();
mLocationHistoryConnection.disconnect();
}
@@ -673,15 +696,41 @@ void LLLocationInputCtrl::refreshParcelIcons()
if (show_properties)
{
LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
+
+ LLViewerRegion* agent_region = gAgent.getRegion();
LLParcel* agent_parcel = vpm->getAgentParcel();
- bool allow_buy = vpm->canAgentBuyParcel( agent_parcel, false);
- bool allow_voice = vpm->allowAgentVoice();
- bool allow_fly = vpm->allowAgentFly();
- bool allow_push = vpm->allowAgentPush();
- bool allow_build = agent_parcel && agent_parcel->getAllowModify(); // true when anyone is allowed to build. See EXT-4610.
- bool allow_scripts = vpm->allowAgentScripts();
- bool allow_damage = vpm->allowAgentDamage();
-
+ if (!agent_region || !agent_parcel)
+ return;
+
+ LLParcel* current_parcel;
+ LLViewerRegion* selection_region = vpm->getSelectionRegion();
+ LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel();
+
+ // If agent is in selected parcel we use its properties because
+ // they are updated more often by LLViewerParcelMgr than agent parcel properties.
+ // See LLViewerParcelMgr::processParcelProperties().
+ // This is needed to reflect parcel restrictions changes without having to leave
+ // the parcel and then enter it again. See EXT-2987
+ if (selected_parcel && selected_parcel->getLocalID() == agent_parcel->getLocalID()
+ && selection_region == agent_region)
+ {
+ current_parcel = selected_parcel;
+ }
+ else
+ {
+ current_parcel = agent_parcel;
+ }
+
+ 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();
+
// Most icons are "block this ability"
mForSaleBtn->setVisible(allow_buy);
mParcelIcon[VOICE_ICON]->setVisible( !allow_voice );
diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h
index 607ccd4da6..a830b33f6f 100644
--- a/indra/newview/lllocationinputctrl.h
+++ b/indra/newview/lllocationinputctrl.h
@@ -42,6 +42,7 @@ class LLLandmark;
// internals
class LLAddLandmarkObserver;
class LLRemoveLandmarkObserver;
+class LLParcelChangeObserver;
class LLMenuGL;
class LLTeleportHistoryItem;
@@ -56,6 +57,7 @@ class LLLocationInputCtrl
LOG_CLASS(LLLocationInputCtrl);
friend class LLAddLandmarkObserver;
friend class LLRemoveLandmarkObserver;
+ friend class LLParcelChangeObserver;
public:
struct Params
@@ -164,6 +166,7 @@ private:
LLAddLandmarkObserver* mAddLandmarkObserver;
LLRemoveLandmarkObserver* mRemoveLandmarkObserver;
+ LLParcelChangeObserver* mParcelChangeObserver;
boost::signals2::connection mParcelMgrConnection;
boost::signals2::connection mLocationHistoryConnection;