AVP-44 WIP architectural cleanup for multi-wearables

Implemented some resident-suggested tweaks to better support multiwearables

code reviewed by Seraph
meow-7.2.2
Nyx (Neal Orman) 2010-05-28 11:38:37 -04:00
parent 9a0a68aa44
commit e07deaa3da
4 changed files with 14 additions and 12 deletions

View File

@ -718,16 +718,16 @@ U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable
{
// no null wearables please!
llwarns << "Null wearable sent for type " << type << llendl;
return MAX_WEARABLES_PER_TYPE;
return MAX_CLOTHING_PER_TYPE;
}
if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE)
if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
{
mWearableDatas[type].push_back(wearable);
wearableUpdated(wearable);
checkWearableAgainstInventory(wearable);
return mWearableDatas[type].size()-1;
}
return MAX_WEARABLES_PER_TYPE;
return MAX_CLOTHING_PER_TYPE;
}
void LLAgentWearables::wearableUpdated(LLWearable *wearable)
@ -764,7 +764,7 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
U32 index = getWearableIndex(wearable);
LLWearableType::EType type = wearable->getType();
if (index < MAX_WEARABLES_PER_TYPE && index < getWearableCount(type))
if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
{
popWearable(type, index);
}
@ -785,7 +785,7 @@ U32 LLAgentWearables::getWearableIndex(LLWearable *wearable)
{
if (wearable == NULL)
{
return MAX_WEARABLES_PER_TYPE;
return MAX_CLOTHING_PER_TYPE;
}
const LLWearableType::EType type = wearable->getType();
@ -793,7 +793,7 @@ U32 LLAgentWearables::getWearableIndex(LLWearable *wearable)
if (wearable_iter == mWearableDatas.end())
{
llwarns << "tried to get wearable index with an invalid type!" << llendl;
return MAX_WEARABLES_PER_TYPE;
return MAX_CLOTHING_PER_TYPE;
}
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
for(U32 index = 0; index < wearable_vec.size(); index++)
@ -804,7 +804,7 @@ U32 LLAgentWearables::getWearableIndex(LLWearable *wearable)
}
}
return MAX_WEARABLES_PER_TYPE;
return MAX_CLOTHING_PER_TYPE;
}
const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const

View File

@ -102,6 +102,9 @@ public:
U32 getWearableCount(const LLWearableType::EType type) const;
U32 getWearableCount(const U32 tex_index) const;
static const U32 MAX_CLOTHING_PER_TYPE = 5;
//--------------------------------------------------------------------
// Setters
//--------------------------------------------------------------------
@ -274,8 +277,6 @@ private:
LLPointer<LLRefCount> mCB;
};
static const U32 MAX_WEARABLES_PER_TYPE = 1;
}; // LLAgentWearables
extern LLAgentWearables gAgentWearables;

View File

@ -970,7 +970,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING, false);
// Reduce wearables to max of one per type.
removeDuplicateItems(wear_items);
filterWearableItems(wear_items, 5);
filterWearableItems(wear_items, LLAgentWearables::MAX_CLOTHING_PER_TYPE);
// - Attachments: include COF contents only if appending.
LLInventoryModel::item_array_t obj_items;
@ -1525,11 +1525,12 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
else
{
LLPointer<LLInventoryCallback> cb = do_update ? new ModifiedCOFCallback : 0;
const std::string description = vitem->getIsLinkType() ? vitem->getDescription() : "";
link_inventory_item( gAgent.getID(),
vitem->getLinkedUUID(),
getCOF(),
vitem->getName(),
vitem->getDescription(),
description,
LLAssetType::AT_LINK,
cb);
}

View File

@ -85,7 +85,7 @@ LLWearableDictionary::LLWearableDictionary()
addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_TATTOO));
addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE));
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE));
addEntry(LLWearableType::WT_COUNT, NULL);
addEntry(LLWearableType::WT_COUNT, new WearableEntry("count", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE));
}
// static