summaryrefslogtreecommitdiff
path: root/indra/llappearance/llwearabledata.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-09-23 17:27:17 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-09-23 19:30:29 +0300
commit3747dd9a085e4d75ec21c8048f1269bc3f29e582 (patch)
tree0b5f21a330c9cfd61b50203d70e6831397403757 /indra/llappearance/llwearabledata.cpp
parent0f4b1b8523add2ffffecbbf9d01d35a9db32106b (diff)
viewer#2631 Optimize LLWearable::writeToAvatar
Diffstat (limited to 'indra/llappearance/llwearabledata.cpp')
-rw-r--r--indra/llappearance/llwearabledata.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp
index 7598ed67f3..f3b76da224 100644
--- a/indra/llappearance/llwearabledata.cpp
+++ b/indra/llappearance/llwearabledata.cpp
@@ -286,43 +286,45 @@ const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type,
LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type)
{
- U32 count = getWearableCount(type);
- if ( count == 0)
+ wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
{
return NULL;
}
+ const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- return getWearable(type, count-1);
+ size_t size = wearable_vec.size();
+ if (size == 0)
+ {
+ return NULL;
+ }
+ return wearable_vec[size - 1];
}
const LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) const
{
- U32 count = getWearableCount(type);
- if ( count == 0)
+ wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
{
return NULL;
}
+ const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- return getWearable(type, count-1);
-}
-
-LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type)
-{
- if (getWearableCount(type) == 0)
+ size_t size = wearable_vec.size();
+ if (size == 0)
{
return NULL;
}
+ return wearable_vec[size - 1];
+}
+LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type)
+{
return getWearable(type, 0);
}
const LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) const
{
- if (getWearableCount(type) == 0)
- {
- return NULL;
- }
-
return getWearable(type, 0);
}