summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-12-04 13:11:22 +0800
committerErik Kundiman <erik@megapahit.org>2025-12-04 13:11:22 +0800
commitd9d932f6375df28dbc59088fc09cd986043651d0 (patch)
tree0dae07bf66d2e8b3ad25a1a9ec994b303a5f01f8 /indra/newview/llagentwearables.cpp
parentdcc927e1d29b2b927ae27f8f50a1dcadb4488c80 (diff)
parent780b5c3bd9a2a97790efc1169817f1fc574f3387 (diff)
Merge branch '2025.08'
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r--indra/newview/llagentwearables.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 93cc4941f1..5801ba1eb8 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -538,6 +538,27 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp
return item;
}
+const S32 LLAgentWearables::getWearableIdxFromItem(const LLViewerInventoryItem* item) const
+{
+ if (!item) return -1;
+ if (!item->isWearableType()) return -1;
+
+ LLWearableType::EType type = item->getWearableType();
+ U32 wearable_count = getWearableCount(type);
+ if (0 == wearable_count) return -1;
+
+ const LLUUID& asset_id = item->getAssetUUID();
+
+ for (U32 i = 0; i < wearable_count; ++i)
+ {
+ const LLViewerWearable* wearable = getViewerWearable(type, i);
+ if (!wearable) continue;
+ if (wearable->getAssetID() != asset_id) continue;
+ return i;
+ }
+
+ return -1;
+}
const LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
@@ -1471,7 +1492,7 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos
LLWearableType::EType type = item->getWearableType();
U32 wearable_count = getWearableCount(type);
- if (0 == wearable_count) return false;
+ if (wearable_count < 2) return false;
const LLUUID& asset_id = item->getAssetUUID();