summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.cpp
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2010-06-03 21:09:49 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2010-06-03 21:09:49 -0400
commit47beb6dc9c4f7c1557536f8116cc98b8bbc24629 (patch)
treecda277cd11cc31ad59f34ea6860fefc2c2e6be16 /indra/newview/llappearancemgr.cpp
parent6286b1cbd495ec589286ee89699a93ce9c1bed77 (diff)
AVP-44 WIP Multi-wearables architecture
One step closer to full support of multi-wearables architecture code will be reviewed before pushing.
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rw-r--r--indra/newview/llappearancemgr.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 5071b1c14a..9da47c9214 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -682,14 +682,15 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up
switch (item_to_wear->getType())
{
case LLAssetType::AT_CLOTHING:
- if (replace && gAgentWearables.areWearablesLoaded())
+ if (gAgentWearables.areWearablesLoaded())
{
S32 wearable_count = gAgentWearables.getWearableCount(item_to_wear->getWearableType());
- if (wearable_count != 0)
+ if ((replace && wearable_count != 0) ||
+ (wearable_count >= LLAgentWearables::MAX_CLOTHING_PER_TYPE) )
{
removeCOFItemLinks(gAgentWearables.getWearableItemID(item_to_wear->getWearableType(), wearable_count-1), false);
}
- }
+ }
case LLAssetType::AT_BODYPART:
// Don't wear anything until initial wearables are loaded, can
// destroy clothing items.
@@ -1584,6 +1585,7 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
item_array,
LLInventoryModel::EXCLUDE_TRASH);
bool linked_already = false;
+ U32 count = 0;
for (S32 i=0; i<item_array.count(); i++)
{
// Are these links to the same object?
@@ -1601,15 +1603,22 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
}
// Are these links to different items of the same body part
// type? If so, new item will replace old.
- // TODO: MULTI-WEARABLE: check for wearable limit for clothing types
- else if (is_body_part && (vitem->isWearableType()) && (vitem->getWearableType() == wearable_type))
+ else if ((vitem->isWearableType()) && (vitem->getWearableType() == wearable_type))
{
- if (inv_item->getIsLinkType() && (vitem->getWearableType() == wearable_type))
+ if (is_body_part && inv_item->getIsLinkType() && (vitem->getWearableType() == wearable_type))
+ {
+ gInventory.purgeObject(inv_item->getUUID());
+ }
+ ++count;
+
+ // MULTI-WEARABLES: make sure we don't go over MAX_CLOTHING_PER_TYPE
+ if (count >= LLAgentWearables::MAX_CLOTHING_PER_TYPE)
{
gInventory.purgeObject(inv_item->getUUID());
}
}
}
+
if (linked_already)
{
if (do_update)