From 49731dd21dec5fb8b6e5781940bab5f5fa9600a2 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Tue, 2 Apr 2013 12:51:45 -0400 Subject: SH-4051 FIX problem with teen account and undershirt layers Updated logic for teen accounts, to ensure that during any transition that they are wearing at least one undershirt wearable and one underpants wearable. --- indra/newview/llagentwearables.cpp | 50 +++++++++++++++++++++++++++++++------- indra/newview/llagentwearables.h | 2 +- 2 files changed, 42 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index ba04991a02..3cee7826fd 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1124,14 +1124,19 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointergetType(); + if (type == LLWearableType::WT_UNDERSHIRT) + { + has_undershirt = true; + } + if (type == LLWearableType::WT_UNDERPANTS) + { + has_underpants = true; + } + } + } + + // TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later if (remove) { @@ -1248,15 +1278,17 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING) { - removeWearable((LLWearableType::EType)type, true, 0); + bool will_replace = false; + if ((type == LLWearableType::WT_UNDERSHIRT && has_undershirt) || + (type == LLWearableType::WT_UNDERPANTS && has_underpants)) + { + will_replace = true; + } + removeWearable((LLWearableType::EType)type, true, 0, will_replace); } } } - S32 count = wearables.count(); - llassert(items.count() == count); - - S32 i; for (i = 0; i < count; i++) { LLViewerWearable* new_wearable = wearables[i]; diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 5be4648636..f2f224a573 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -146,7 +146,7 @@ private: // Removing wearables //-------------------------------------------------------------------- public: - void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/); + void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/, BOOL will_replace = false); private: void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/); protected: -- cgit v1.2.3