From 5c2d187d6fb296876c2c3cba5817c749598f4283 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 4 Nov 2009 18:58:27 -0500 Subject: Small cleanup in LLAgentWearables.cpp --- indra/newview/llagentwearables.cpp | 6 +-- indra/newview/llagentwearables.h | 6 +-- indra/newview/llviewermenu.cpp | 102 ++++--------------------------------- 3 files changed, 15 insertions(+), 99 deletions(-) diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 7d215b5778..d8aca860d5 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1724,10 +1724,8 @@ void LLAgentWearables::queryWearableCache() // MULTI_WEARABLE: need a way to specify by wearable rather than by type. // User has picked "remove from avatar" from a menu. // static -void LLAgentWearables::userRemoveWearable(void* userdata) +void LLAgentWearables::userRemoveWearable(EWearableType& type) { - EWearableType type = (EWearableType)(intptr_t)userdata; - if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR)) //&& //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT))) { @@ -1737,7 +1735,7 @@ void LLAgentWearables::userRemoveWearable(void* userdata) } // static -void LLAgentWearables::userRemoveAllClothes(void* userdata) +void LLAgentWearables::userRemoveAllClothes() { // We have to do this up front to avoid having to deal with the case of multiple wearables being dirty. if (gFloaterCustomize) diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 97de785c87..317f4a7e4f 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -191,9 +191,9 @@ public: //-------------------------------------------------------------------- public: // MULTI-WEARABLE: assuming one wearable per type. Need upstream changes. - static void userRemoveWearable(void* userdata); // userdata is EWearableType - static void userRemoveAllClothes(void* userdata); // userdata is NULL - + static void userRemoveWearable(EWearableType& type); + static void userRemoveAllClothes(); + typedef std::vector llvo_vec_t; static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 23ceb1e72d..c85ed46cd6 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7461,52 +7461,10 @@ class LLEditEnableTakeOff : public view_listener_t bool handleEvent(const LLSD& userdata) { std::string clothing = userdata.asString(); - bool new_value = false; - if (clothing == "shirt") - { - new_value = LLAgentWearables::selfHasWearable(WT_SHIRT); - } - if (clothing == "pants") - { - new_value = LLAgentWearables::selfHasWearable(WT_PANTS); - } - if (clothing == "shoes") - { - new_value = LLAgentWearables::selfHasWearable(WT_SHOES); - } - if (clothing == "socks") - { - new_value = LLAgentWearables::selfHasWearable(WT_SOCKS); - } - if (clothing == "jacket") - { - new_value = LLAgentWearables::selfHasWearable(WT_JACKET); - } - if (clothing == "gloves") - { - new_value = LLAgentWearables::selfHasWearable(WT_GLOVES); - } - if (clothing == "undershirt") - { - new_value = LLAgentWearables::selfHasWearable(WT_UNDERSHIRT); - } - if (clothing == "underpants") - { - new_value = LLAgentWearables::selfHasWearable(WT_UNDERPANTS); - } - if (clothing == "skirt") - { - new_value = LLAgentWearables::selfHasWearable(WT_SKIRT); - } - if (clothing == "alpha") - { - new_value = LLAgentWearables::selfHasWearable(WT_ALPHA); - } - if (clothing == "tattoo") - { - new_value = LLAgentWearables::selfHasWearable(WT_TATTOO); - } - return new_value; + EWearableType type = LLWearableDictionary::typeNameToType(clothing); + if (type >= WT_SHAPE && type < WT_COUNT) + return LLAgentWearables::selfHasWearable(type); + return false; } }; @@ -7515,53 +7473,13 @@ class LLEditTakeOff : public view_listener_t bool handleEvent(const LLSD& userdata) { std::string clothing = userdata.asString(); - if (clothing == "shirt") - { - LLAgentWearables::userRemoveWearable((void*)WT_SHIRT); - } - else if (clothing == "pants") - { - LLAgentWearables::userRemoveWearable((void*)WT_PANTS); - } - else if (clothing == "shoes") - { - LLAgentWearables::userRemoveWearable((void*)WT_SHOES); - } - else if (clothing == "socks") - { - LLAgentWearables::userRemoveWearable((void*)WT_SOCKS); - } - else if (clothing == "jacket") - { - LLAgentWearables::userRemoveWearable((void*)WT_JACKET); - } - else if (clothing == "gloves") - { - LLAgentWearables::userRemoveWearable((void*)WT_GLOVES); - } - else if (clothing == "undershirt") - { - LLAgentWearables::userRemoveWearable((void*)WT_UNDERSHIRT); - } - else if (clothing == "underpants") - { - LLAgentWearables::userRemoveWearable((void*)WT_UNDERPANTS); - } - else if (clothing == "skirt") - { - LLAgentWearables::userRemoveWearable((void*)WT_SKIRT); - } - else if (clothing == "alpha") - { - LLAgentWearables::userRemoveWearable((void*)WT_ALPHA); - } - else if (clothing == "tattoo") - { - LLAgentWearables::userRemoveWearable((void*)WT_TATTOO); - } - else if (clothing == "all") + if (clothing == "all") + LLAgentWearables::userRemoveAllClothes(); + else { - LLAgentWearables::userRemoveAllClothes(NULL); + EWearableType type = LLWearableDictionary::typeNameToType(clothing); + if (type >= WT_SHAPE && type < WT_COUNT) + LLAgentWearables::userRemoveWearable(type); } return true; } -- cgit v1.2.3