summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rwxr-xr-xindra/newview/llagentwearables.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 06b86e311a..cce1eb5895 100755
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -986,6 +986,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
S32 matched = 0, mismatched = 0;
const S32 arr_size = LLWearableType::WT_COUNT;
S32 type_counts[arr_size];
+ BOOL update_inventory = FALSE;
std::fill(type_counts,type_counts+arr_size,0);
for (S32 i = 0; i < count; i++)
{
@@ -1013,10 +1014,9 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
continue;
}
- // Don't care about this case - ordering of wearables with the same asset id has no effect.
- // Causes the two-alphas error case in MAINT-4158.
+ // Update only inventory in this case - ordering of wearables with the same asset id has no effect.
+ // Updating wearables in this case causes the two-alphas error in MAINT-4158.
// We should actually disallow wearing two wearables with the same asset id.
-#if 0
if (curr_wearable->getName() != new_item->getName() ||
curr_wearable->getItemID() != new_item->getUUID())
{
@@ -1024,10 +1024,9 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
<< curr_wearable->getName() << " vs " << new_item->getName()
<< " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID()
<< LL_ENDL;
- mismatched++;
+ update_inventory = TRUE;
continue;
}
-#endif
// If we got here, everything matches.
matched++;
}
@@ -1041,14 +1040,15 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
mismatched++;
}
}
- if (mismatched == 0)
+ if (mismatched == 0 && !update_inventory)
{
LL_DEBUGS("Avatar") << "no changes, bailing out" << LL_ENDL;
mCOFChangeInProgress = false;
return;
}
-
-
+
+ // updating inventory
+
// 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
@@ -1069,7 +1069,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
if (new_wearable)
{
const LLWearableType::EType type = new_wearable->getType();
-
+
+ LLUUID old_wearable_id = new_wearable->getItemID();
new_wearable->setName(new_item->getName());
new_wearable->setItemID(new_item->getUUID());
@@ -1077,11 +1078,18 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
{
// exactly one wearable per body part
setWearable(type,0,new_wearable);
+ if (old_wearable_id.notNull())
+ {
+ // we changed id before setting wearable, update old item manually
+ // to complete the swap.
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, old_wearable_id);
+ }
}
else
{
pushWearable(type,new_wearable);
}
+
const BOOL removed = FALSE;
wearableUpdated(new_wearable, removed);
}
@@ -1089,6 +1097,15 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
gInventory.notifyObservers();
+ if (mismatched == 0)
+ {
+ LL_DEBUGS("Avatar") << "inventory updated, wearable assets not changed, bailing out" << LL_ENDL;
+ mCOFChangeInProgress = false;
+ return;
+ }
+
+ // updating agent avatar
+
if (isAgentAvatarValid())
{
gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);