summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2016-02-26 20:18:50 +0200
committerandreykproductengine <akleshchev@productengine.com>2016-02-26 20:18:50 +0200
commitdebc51af6b6a35f7f635be9483a3bc4d0846a90d (patch)
treefefa6db7f60b840317fd333a59846681101184b9 /indra/newview
parent5304945e03d6297a9fe78e7038f7154dcbbb87f1 (diff)
MAINT-1539 'L$' indicator doesn't disappear when object is not for sale
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llpanelpermissions.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 263c73dc0e..0088163fee 100755
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -1080,28 +1080,30 @@ void LLPanelPermissions::setAllSaleInfo()
LLSaleInfo new_sale_info(sale_type, price);
LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info);
-
- U8 old_click_action = 0;
- LLSelectMgr::getInstance()->selectionGetClickAction(&old_click_action);
- if (old_sale_info.isForSale()
- && !new_sale_info.isForSale()
- && old_click_action == CLICK_ACTION_BUY)
- {
- // If turned off for-sale, make sure click-action buy is turned
- // off as well
- LLSelectMgr::getInstance()->
- selectionSetClickAction(CLICK_ACTION_TOUCH);
- }
- else if (new_sale_info.isForSale()
- && !old_sale_info.isForSale()
- && old_click_action == CLICK_ACTION_TOUCH)
- {
- // If just turning on for-sale, preemptively turn on one-click buy
- // unless user have a different click action set
- LLSelectMgr::getInstance()->
- selectionSetClickAction(CLICK_ACTION_BUY);
- }
+ bool selection_set_for_sale = new_sale_info.isForSale();
+ bool selection_was_for_sale = old_sale_info.isForSale();
+ if (selection_was_for_sale != selection_set_for_sale)
+ {
+ // sale state changed, switch click-actions
+ // but don't touch user changed actions
+ U8 old_action = selection_set_for_sale ? CLICK_ACTION_TOUCH : CLICK_ACTION_BUY;
+ U8 new_action = selection_set_for_sale ? CLICK_ACTION_BUY : CLICK_ACTION_TOUCH;
+ struct f : public LLSelectedObjectFunctor
+ {
+ U8 mActionOld, mActionNew;
+ f(const U8& t_old, const U8& t_new) : mActionOld(t_old), mActionNew(t_new) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->getClickAction() == mActionOld)
+ {
+ object->setClickAction(mActionNew);
+ }
+ return true;
+ }
+ } func(old_action, new_action);
+ LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func);
+ }
}
struct LLSelectionPayable : public LLSelectedObjectFunctor