Initial AISv3 merge. New HTTP messages not plugged in yet.

This commit is contained in:
Shyotl
2015-06-25 20:16:30 -05:00
parent 09f4528bfb
commit 9f10d9510d
71 changed files with 4962 additions and 3452 deletions

View File

@@ -94,7 +94,7 @@ void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LL
}
}
U32 LLWearableData::pushWearable(const LLWearableType::EType type,
void LLWearableData::pushWearable(const LLWearableType::EType type,
LLWearable *wearable,
bool trigger_updated /* = true */)
{
@@ -102,38 +102,19 @@ U32 LLWearableData::pushWearable(const LLWearableType::EType type,
{
// no null wearables please!
LL_WARNS() << "Null wearable sent for type " << type << LL_ENDL;
return MAX_CLOTHING_PER_TYPE;
}
// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
if ( (type < LLWearableType::WT_COUNT) && (mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) )
if (canAddWearable(type))
{
// Don't add the same wearable twice
U32 idxWearable = getWearableIndex(wearable);
llassert(MAX_CLOTHING_PER_TYPE == idxWearable); // pushWearable() on an already added wearable is a bug *somewhere*
if (MAX_CLOTHING_PER_TYPE == idxWearable)
{
mWearableDatas[type].push_back(wearable);
idxWearable = mWearableDatas[type].size() - 1;
}
// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
if (std::find(mWearableDatas[type].begin(), mWearableDatas[type].end(), wearable) == mWearableDatas[type].end())
// [/RLVa:KB]
mWearableDatas[type].push_back(wearable);
if (trigger_updated)
{
const BOOL removed = FALSE;
wearableUpdated(wearable, removed);
}
return idxWearable;
}
// [/RLVa:KB]
// if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
// {
// mWearableDatas[type].push_back(wearable);
// if (trigger_updated)
// {
// const BOOL removed = FALSE;
// wearableUpdated(wearable, removed);
// }
// return mWearableDatas[type].size()-1;
// }
return MAX_CLOTHING_PER_TYPE;
}
// virtual
@@ -146,7 +127,7 @@ void LLWearableData::wearableUpdated(LLWearable *wearable, BOOL removed)
}
}
void LLWearableData::popWearable(LLWearable *wearable)
void LLWearableData::eraseWearable(LLWearable *wearable)
{
if (wearable == NULL)
{
@@ -154,18 +135,17 @@ void LLWearableData::popWearable(LLWearable *wearable)
return;
}
U32 index = getWearableIndex(wearable);
const LLWearableType::EType type = wearable->getType();
if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
U32 index;
if (getWearableIndex(wearable,index))
{
popWearable(type, index);
eraseWearable(type, index);
}
}
void LLWearableData::popWearable(const LLWearableType::EType type, U32 index)
void LLWearableData::eraseWearable(const LLWearableType::EType type, U32 index)
{
//llassert_always(index == 0);
LLWearable *wearable = getWearable(type, index);
if (wearable)
{
@@ -225,11 +205,11 @@ void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type)
}
U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const
BOOL LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_found) const
{
if (wearable == NULL)
{
return MAX_CLOTHING_PER_TYPE;
return FALSE;
}
const LLWearableType::EType type = wearable->getType();
@@ -237,18 +217,50 @@ U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const
if (wearable_iter == mWearableDatas.end())
{
LL_WARNS() << "tried to get wearable index with an invalid type!" << LL_ENDL;
return MAX_CLOTHING_PER_TYPE;
return FALSE;
}
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
for(U32 index = 0; index < wearable_vec.size(); index++)
{
if (wearable_vec[index] == wearable)
{
return index;
index_found = index;
return TRUE;
}
}
return MAX_CLOTHING_PER_TYPE;
return FALSE;
}
U32 LLWearableData::getClothingLayerCount() const
{
U32 count = 0;
for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
{
LLWearableType::EType type = (LLWearableType::EType)i;
if (LLWearableType::getAssetType(type)==LLAssetType::AT_CLOTHING)
{
count += getWearableCount(type);
}
}
return count;
}
BOOL LLWearableData::canAddWearable(const LLWearableType::EType type) const
{
LLAssetType::EType a_type = LLWearableType::getAssetType(type);
if (a_type==LLAssetType::AT_CLOTHING)
{
return (getClothingLayerCount() < MAX_CLOTHING_LAYERS);
}
else if (a_type==LLAssetType::AT_BODYPART)
{
return (getWearableCount(type) < 1);
}
else
{
return FALSE;
}
}
BOOL LLWearableData::isOnTop(LLWearable* wearable) const

View File

@@ -61,11 +61,13 @@ public:
const LLWearable* getBottomWearable(const LLWearableType::EType type) const;
U32 getWearableCount(const LLWearableType::EType type) const;
U32 getWearableCount(const U32 tex_index) const;
U32 getWearableIndex(const LLWearable *wearable) const;
BOOL getWearableIndex(const LLWearable *wearable, U32& index) const;
U32 getClothingLayerCount() const;
BOOL canAddWearable(const LLWearableType::EType type) const;
BOOL isOnTop(LLWearable* wearable) const;
static const U32 MAX_CLOTHING_PER_TYPE = 5;
static const U32 MAX_CLOTHING_LAYERS = 60;
//--------------------------------------------------------------------
// Setters
@@ -73,11 +75,11 @@ public:
protected:
// Low-level data structure setter - public access is via setWearableItem, etc.
void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable,
void pushWearable(const LLWearableType::EType type, LLWearable *wearable,
bool trigger_updated = true);
virtual void wearableUpdated(LLWearable *wearable, BOOL removed);
void popWearable(LLWearable *wearable);
void popWearable(const LLWearableType::EType type, U32 index);
void eraseWearable(LLWearable *wearable);
void eraseWearable(const LLWearableType::EType type, U32 index);
void clearWearableType(const LLWearableType::EType type);
bool swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b);