From 404ed736ec99acb81b0368f4402bba2504518bfd Mon Sep 17 00:00:00 2001 From: Neal Orman Date: Mon, 19 Oct 2009 21:02:33 +0000 Subject: Remove "add" inventory operation and rename MAX_WEARABLES_PER_TYPE This patch removes the invalid "add" operation shown on wearables in inventory It also renames MAX_WEARABLES_PER_TYPE, resets the value to 1 (non-multi-wearables), and adds a weak check to enforce one wearable per type. Code reviewed by Vir --- indra/newview/llagentwearables.cpp | 12 ++++++------ indra/newview/llagentwearables.h | 2 +- indra/newview/skins/default/xui/en/menu_inventory.xml | 8 -------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 223f8779ec..34d2c00007 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -655,20 +655,20 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl { // no null wearables please! //TODO: insert llwarns - return MAX_ATTACHMENTS_PER_TYPE; + return MAX_WEARABLES_PER_TYPE; } - if (type < WT_COUNT) + if (type < WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE) { mWearableDatas[type].push_back(wearable); return mWearableDatas[type].size()-1; } - return MAX_ATTACHMENTS_PER_TYPE; + return MAX_WEARABLES_PER_TYPE; } void LLAgentWearables::popWearable(const EWearableType type, LLWearable *wearable) { U32 index = getWearableIndex(type, wearable); - if (index < MAX_ATTACHMENTS_PER_TYPE && index < getWearableCount(type)) + if (index < MAX_WEARABLES_PER_TYPE && index < getWearableCount(type)) { popWearable(type, index); } @@ -688,7 +688,7 @@ U32 LLAgentWearables::getWearableIndex(const EWearableType type, LLWearable *wea if (wearable_iter == mWearableDatas.end()) { llwarns << "tried to get wearable index with an invalid type!" << llendl; - return MAX_ATTACHMENTS_PER_TYPE; + return MAX_WEARABLES_PER_TYPE; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; for(U32 index = 0; index < wearable_vec.size(); index++) @@ -699,7 +699,7 @@ U32 LLAgentWearables::getWearableIndex(const EWearableType type, LLWearable *wea } } - return MAX_ATTACHMENTS_PER_TYPE; + return MAX_WEARABLES_PER_TYPE; } const LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index) const diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index d147b0447b..6b456abfa7 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -258,7 +258,7 @@ private: LLPointer mCB; }; - static const U32 MAX_ATTACHMENTS_PER_TYPE = 4; + static const U32 MAX_WEARABLES_PER_TYPE = 1; }; // LLAgentWearables diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 7785492651..62940b87dc 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -603,14 +603,6 @@ function="Inventory.DoToSelected" parameter="wear" /> - - -