diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-11-04 18:58:27 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-11-04 18:58:27 -0500 |
commit | 5c2d187d6fb296876c2c3cba5817c749598f4283 (patch) | |
tree | c01e7658538543c8306b5ecede75aaa3a1350edb /indra | |
parent | dc365be4d23d8070a4f9e670918dbe8ccbe8cc79 (diff) |
Small cleanup in LLAgentWearables.cpp
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llagentwearables.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llagentwearables.h | 6 | ||||
-rw-r--r-- | 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<LLViewerObject*> 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; } |