summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2013-08-29 17:08:30 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2013-08-29 17:08:30 -0400
commitf426f8a694429209ca0eeea9156173e8a12ddc46 (patch)
tree9e2be1940e48ec22c4b7bc135a5a98bc1921c090
parent3a0cd466f1182f5868dc21b951d78796542abd7d (diff)
SH-4455 WIP - versioned some metrics whose usage has changed, added name and item id checks in setWearableOutfit()
-rwxr-xr-xindra/newview/llagentwearables.cpp52
-rwxr-xr-xindra/newview/llappearancemgr.cpp8
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<S32> 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<LLInventoryItem> new_item = items[i];
+
const LLWearableType::EType type = new_wearable->getType();
- S32 index = type_counts[type];
- LLViewerWearable *curr_wearable = dynamic_cast<LLViewerWearable*>(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<LLViewerWearable*>(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<LLWearableType::WT_COUNT; j++)
@@ -1275,7 +1293,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
}
if (mismatched == 0)
{
- LL_DEBUGS("Avatar") << "nothing to do" << llendl;
+ LL_DEBUGS("Avatar") << "no changes, bailing out" << llendl;
return;
}
@@ -1283,15 +1301,15 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later
// note: shirt is the first non-body part wearable item. Update if wearable order changes.
// This loop should remove all clothing, but not any body parts
- for (S32 type = 0; type < (S32)LLWearableType::WT_COUNT; type++)
+ for (S32 j = 0; j < (S32)LLWearableType::WT_COUNT; j++)
{
- if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING)
+ if (LLWearableType::getAssetType((LLWearableType::EType)j) == LLAssetType::AT_CLOTHING)
{
- removeWearable((LLWearableType::EType)type, true, 0);
+ removeWearable((LLWearableType::EType)j, true, 0);
}
}
- for (i = 0; i < count; i++)
+ for (S32 i = 0; i < count; i++)
{
LLViewerWearable* new_wearable = wearables[i];
LLPointer<LLInventoryItem> 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)