From f426f8a694429209ca0eeea9156173e8a12ddc46 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 29 Aug 2013 17:08:30 -0400 Subject: SH-4455 WIP - versioned some metrics whose usage has changed, added name and item id checks in setWearableOutfit() --- indra/newview/llagentwearables.cpp | 52 +++++++++++++++++++++++++------------- indra/newview/llappearancemgr.cpp | 8 +++--- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 326c584c32..8501436b5b 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1237,31 +1237,49 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it S32 count = wearables.count(); llassert(items.count() == count); - // Check for whether outfit already matches the one requested (!) - S32 i; - + // Check for whether outfit already matches the one requested S32 matched = 0, mismatched = 0; - std::vector type_counts(LLWearableType::WT_COUNT,0); - for (i = 0; i < count; i++) + const S32 arr_size = LLWearableType::WT_COUNT; + S32 type_counts[arr_size]; + std::fill(type_counts,type_counts+arr_size,0); + for (S32 i = 0; i < count; i++) { LLViewerWearable* new_wearable = wearables[i]; LLPointer new_item = items[i]; + const LLWearableType::EType type = new_wearable->getType(); - S32 index = type_counts[type]; - LLViewerWearable *curr_wearable = dynamic_cast(getWearable(type,index)); - if (new_wearable && curr_wearable && - new_wearable->getAssetID() == curr_wearable->getAssetID()) + if (type < 0 || type>=LLWearableType::WT_COUNT) { - matched++; + llwarns << "invalid type " << type << llendl; + mismatched++; + continue; } - else + S32 index = type_counts[type]; + type_counts[type]++; + + LLViewerWearable *curr_wearable = dynamic_cast(getWearable(type,index)); + if (!new_wearable || !curr_wearable || + new_wearable->getAssetID() != curr_wearable->getAssetID()) { LL_DEBUGS("Avatar") << "mismatch, type " << type << " index " << index << " names " << (curr_wearable ? curr_wearable->getName() : "NONE") << "," << " names " << (new_wearable ? new_wearable->getName() : "NONE") << llendl; mismatched++; + continue; } - type_counts[type]++; + + if (curr_wearable->getName() != new_item->getName() || + curr_wearable->getItemID() != new_item->getUUID()) + { + LL_DEBUGS("Avatar") << "mismatch on name or inventory id, names " + << curr_wearable->getName() << " vs " << new_item->getName() + << " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID() + << llendl; + mismatched++; + continue; + } + // If we got here, everything matches. + matched++; } LL_DEBUGS("Avatar") << "matched " << matched << " mismatched " << mismatched << llendl; for (S32 j=0; j new_item = items[i]; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index eada358e8d..7fbe84312e 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -768,7 +768,7 @@ void LLWearableHoldingPattern::checkMissingWearables() if (isMostRecent()) { - selfStartPhase("get_missing_wearables"); + selfStartPhase("get_missing_wearables_2"); } if (!pollMissingWearables()) { @@ -835,7 +835,7 @@ void LLWearableHoldingPattern::onFetchCompletion() { if (isMostRecent()) { - selfStopPhase("get_wearables"); + selfStopPhase("get_wearables_2"); } if (!isMostRecent()) @@ -1014,7 +1014,7 @@ bool LLWearableHoldingPattern::pollMissingWearables() { if (isMostRecent()) { - selfStopPhase("get_missing_wearables"); + selfStopPhase("get_missing_wearables_2"); } gAgentAvatarp->debugWearablesLoaded(); @@ -2185,7 +2185,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool enforce_item_restrictions, } } - selfStartPhase("get_wearables"); + selfStartPhase("get_wearables_2"); for (LLWearableHoldingPattern::found_list_t::iterator it = holder->getFoundList().begin(); it != holder->getFoundList().end(); ++it) -- cgit v1.2.3