diff options
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r-- | indra/newview/llselectmgr.cpp | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 5eacb25ded..96c9ec113b 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2827,27 +2827,53 @@ void LLSelectMgr::selectForceDelete() SEND_ONLY_ROOTS); } - -// returns TRUE if anything is for sale. calculates the total price -// and stores that value in price. -BOOL LLSelectMgr::selectIsForSale(S32& price) +void LLSelectMgr::selectGetAggregateSaleInfo(U32 &num_for_sale, + BOOL &is_for_sale_mixed, + BOOL &is_sale_price_mixed, + S32 &total_sale_price, + S32 &individual_sale_price) { - BOOL any_for_sale = FALSE; - price = 0; + num_for_sale = 0; + is_for_sale_mixed = FALSE; + is_sale_price_mixed = FALSE; + total_sale_price = 0; + individual_sale_price = 0; + + // Empty set. + if (getSelection()->root_begin() == getSelection()->root_end()) + return; + + LLSelectNode *node = *(getSelection()->root_begin()); + const BOOL first_node_for_sale = node->mSaleInfo.isForSale(); + const S32 first_node_sale_price = node->mSaleInfo.getSalePrice(); + for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); iter != getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; - if (node->mSaleInfo.isForSale()) + const BOOL node_for_sale = node->mSaleInfo.isForSale(); + const S32 node_sale_price = node->mSaleInfo.getSalePrice(); + + // Set mixed if the fields don't match the first node's fields. + if (node_for_sale != first_node_for_sale) + is_for_sale_mixed = TRUE; + if (node_sale_price != first_node_sale_price) + is_sale_price_mixed = TRUE; + + if (node_for_sale) { - price += node->mSaleInfo.getSalePrice(); - any_for_sale = TRUE; + total_sale_price += node_sale_price; + num_for_sale ++; } } - - return any_for_sale; - + + individual_sale_price = first_node_sale_price; + if (is_for_sale_mixed) + { + is_sale_price_mixed = TRUE; + individual_sale_price = 0; + } } // returns TRUE if all nodes are valid. method also stores an @@ -3503,8 +3529,6 @@ void LLSelectMgr::selectionSetObjectCategory(const LLCategory& category) void LLSelectMgr::selectionSetObjectSaleInfo(const LLSaleInfo& sale_info) { - // Only one sale info at a time for now - if(mSelectedObjects->getRootObjectCount() != 1) return; sendListToRegions("ObjectSaleInfo", packAgentAndSessionID, packObjectSaleInfo, |