summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
commitcde1174345224d33d6b45b1e3243fa39043223e5 (patch)
tree6c8db6e0499622d8c7206a11c997eb173ebd478f /indra/newview/llagentwearables.cpp
parent6f454ad8366ed33bbe199c3fc3ed69e6d3448cec (diff)
parent35efadf78315f9b351415930dca4fae251ef4dd0 (diff)
Merge branch 'main' into release/luau-scripting.
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r--indra/newview/llagentwearables.cpp104
1 files changed, 44 insertions, 60 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index d2046c0f83..faa5d801dd 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -56,7 +56,7 @@
LLAgentWearables gAgentWearables;
-BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE;
+bool LLAgentWearables::mInitialWearablesUpdateReceived = false;
using namespace LLAvatarAppearanceDefines;
@@ -76,7 +76,7 @@ void set_default_permissions(LLViewerInventoryItem* item)
item->setPermissions(perm);
- item->updateServer(FALSE);
+ item->updateServer(false);
}
}
@@ -194,7 +194,7 @@ struct LLAgentDumper
LLAgentWearables::LLAgentWearables() :
LLWearableData(),
- mWearablesLoaded(FALSE)
+ mWearablesLoaded(false)
, mCOFChangeInProgress(false)
{
}
@@ -304,7 +304,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
item->setAssetUUID(wearable->getAssetID());
item->setTransactionID(wearable->getTransactionID());
gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id);
- item->updateServer(FALSE);
+ item->updateServer(false);
}
gInventory.notifyObservers();
}
@@ -375,7 +375,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
const U32 index,
const std::string& new_name,
const std::string& description,
- BOOL save_in_lost_and_found)
+ bool save_in_lost_and_found)
{
if (!isWearableCopyable(type, index))
{
@@ -493,13 +493,13 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
}
-BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
+bool LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
{
LLUUID item_id = getWearableItemID(type, index);
- return item_id.notNull() ? isWearableModifiable(item_id) : FALSE;
+ return item_id.notNull() ? isWearableModifiable(item_id) : false;
}
-BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
+bool LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
{
const LLUUID& linked_id = gInventory.getLinkedItemID(item_id);
if (linked_id.notNull())
@@ -508,13 +508,13 @@ BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
if (item && item->getPermissions().allowModifyBy(gAgent.getID(),
gAgent.getGroupID()))
{
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const
+bool LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const
{
LLUUID item_id = getWearableItemID(type, index);
if (!item_id.isNull())
@@ -523,27 +523,11 @@ BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index)
if (item && item->getPermissions().allowCopyBy(gAgent.getID(),
gAgent.getGroupID()))
{
- return TRUE;
+ return true;
}
}
- return FALSE;
-}
-
-/*
- U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type)
- {
- LLUUID item_id = getWearableItemID(type);
- if (!item_id.isNull())
- {
- LLInventoryItem* item = gInventory.getItem(item_id);
- if (item)
- {
- return item->getPermissions().getMaskOwner();
- }
- }
- return PERM_NONE;
- }
-*/
+ return false;
+}
LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index)
{
@@ -617,13 +601,13 @@ const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType
}
// static
-BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
+bool LLAgentWearables::selfHasWearable(LLWearableType::EType type)
{
return (gAgentWearables.getWearableCount(type) > 0);
}
// virtual
-void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
+void LLAgentWearables::wearableUpdated(LLWearable *wearable, bool removed)
{
if (isAgentAvatarValid())
{
@@ -675,9 +659,9 @@ const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U3
return LLUUID();
}
-BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const
+bool LLAgentWearables::isWearingItem(const LLUUID& item_id) const
{
- return getWearableFromItemID(item_id) != NULL;
+ return getWearableFromItemID(item_id) != nullptr;
}
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
@@ -772,21 +756,21 @@ void LLAgentWearables::createStandardWearables()
if (!isAgentAvatarValid()) return;
- const BOOL create[LLWearableType::WT_COUNT] =
+ constexpr bool create[LLWearableType::WT_COUNT] =
{
- TRUE, //LLWearableType::WT_SHAPE
- TRUE, //LLWearableType::WT_SKIN
- TRUE, //LLWearableType::WT_HAIR
- TRUE, //LLWearableType::WT_EYES
- TRUE, //LLWearableType::WT_SHIRT
- TRUE, //LLWearableType::WT_PANTS
- TRUE, //LLWearableType::WT_SHOES
- TRUE, //LLWearableType::WT_SOCKS
- FALSE, //LLWearableType::WT_JACKET
- FALSE, //LLWearableType::WT_GLOVES
- TRUE, //LLWearableType::WT_UNDERSHIRT
- TRUE, //LLWearableType::WT_UNDERPANTS
- FALSE //LLWearableType::WT_SKIRT
+ true, //LLWearableType::WT_SHAPE
+ true, //LLWearableType::WT_SKIN
+ true, //LLWearableType::WT_HAIR
+ true, //LLWearableType::WT_EYES
+ true, //LLWearableType::WT_SHIRT
+ true, //LLWearableType::WT_PANTS
+ true, //LLWearableType::WT_SHOES
+ true, //LLWearableType::WT_SOCKS
+ false, //LLWearableType::WT_JACKET
+ false, //LLWearableType::WT_GLOVES
+ true, //LLWearableType::WT_UNDERSHIRT
+ true, //LLWearableType::WT_UNDERPANTS
+ false //LLWearableType::WT_SKIRT
};
LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
@@ -865,7 +849,7 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
LLViewerWearable* wearable,
const LLUUID& category_id,
- BOOL notify)
+ bool notify)
{
create_inventory_wearable(gAgent.getID(),
gAgent.getSessionID(),
@@ -980,16 +964,16 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
{
LL_INFOS() << "setWearableOutfit() start" << LL_ENDL;
- S32 count = wearables.size();
+ auto count = wearables.size();
llassert(items.size() == count);
// Check for whether outfit already matches the one requested
S32 matched = 0, mismatched = 0;
const S32 arr_size = LLWearableType::WT_COUNT;
S32 type_counts[arr_size];
- BOOL update_inventory = FALSE;
+ bool update_inventory{ false };
std::fill(type_counts,type_counts+arr_size,0);
- for (S32 i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
LLViewerWearable* new_wearable = wearables[i];
LLPointer<LLInventoryItem> new_item = items[i];
@@ -1025,7 +1009,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
<< curr_wearable->getName() << " vs " << new_item->getName()
<< " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID()
<< LL_ENDL;
- update_inventory = TRUE;
+ update_inventory = true;
continue;
}
// If we got here, everything matches.
@@ -1092,7 +1076,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
pushWearable(type,new_wearable);
}
- const BOOL removed = FALSE;
+ constexpr bool removed = false;
wearableUpdated(new_wearable, removed);
}
}
@@ -1110,7 +1094,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
if (isAgentAvatarValid())
{
- gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
+ gAgentAvatarp->setCompositeUpdatesEnabled(true);
// If we have not yet declouded, we may want to use
// baked texture UUIDs sent from the first objectUpdate message
@@ -1124,7 +1108,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
}
// Start rendering & update the server
- mWearablesLoaded = TRUE;
+ mWearablesLoaded = true;
notifyLoadingFinished();
@@ -1423,7 +1407,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array)
{
// Build a compound message to send all the objects that need to be rezzed.
- S32 obj_count = obj_item_array.size();
+ auto obj_count = obj_item_array.size();
if (obj_count > 0)
{
LL_DEBUGS("Avatar") << "ATT attaching multiple, total obj_count " << obj_count << LL_ENDL;
@@ -1434,7 +1418,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
++it)
{
const LLInventoryItem* item = *it;
- LLAttachmentsMgr::instance().addAttachmentRequest(item->getLinkedUUID(), 0, TRUE);
+ LLAttachmentsMgr::instance().addAttachmentRequest(item->getLinkedUUID(), 0, true);
}
}
@@ -1452,7 +1436,7 @@ bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_bod
return wearable != marginal_wearable;
}
-BOOL LLAgentWearables::areWearablesLoaded() const
+bool LLAgentWearables::areWearablesLoaded() const
{
return mWearablesLoaded;
}
@@ -1620,7 +1604,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id)
return;
}
- const BOOL disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType());
+ const bool disable_camera_switch = LLWearableType::getInstance()->getDisableCameraSwitch(wearable->getType());
LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance");
LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch);
}