summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rw-r--r--indra/newview/llappearancemgr.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 30f07a873b..19b81f5a79 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -31,6 +31,7 @@
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
+#include "llappearancelistener.h"
#include "llappearancemgr.h"
#include "llattachmentsmgr.h"
#include "llcommandhandler.h"
@@ -71,6 +72,8 @@
#pragma warning (disable:4702)
#endif
+LLAppearanceListener sAppearanceListener;
+
namespace
{
const S32 BAKE_RETRY_MAX_COUNT = 5;
@@ -2900,8 +2903,7 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego
LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append);
}
-// FIXME do we really want to search entire inventory for matching name?
-void LLAppearanceMgr::wearOutfitByName(const std::string& name)
+bool LLAppearanceMgr::wearOutfitByName(const std::string& name, bool append, std::string& error_msg)
{
LL_INFOS("Avatar") << self_av_string() << "Wearing category " << name << LL_ENDL;
@@ -2936,13 +2938,29 @@ void LLAppearanceMgr::wearOutfitByName(const std::string& name)
if(cat)
{
- LLAppearanceMgr::wearInventoryCategory(cat, copy_items, false);
+ bool is_system_folder = LLFolderType::lookupIsProtectedType(cat->getPreferredType());
+ if (is_system_folder)
+ {
+ error_msg = stringize("Can't wear system folder ", std::quoted(name));
+ return false;
+ }
+ bool can_wear = append ? getCanAddToCOF(cat->getUUID()) : getCanReplaceCOF(cat->getUUID());
+ if (!can_wear)
+ {
+ std::string msg = append ? "Can't add to COF outfit " : "Can't replace COF with outfit ";
+ error_msg = stringize(msg, std::quoted(name), " , id: ", cat->getUUID());
+ LL_WARNS() << error_msg << LL_ENDL;
+ return false;
+ }
+ LLAppearanceMgr::wearInventoryCategory(cat, copy_items, append);
}
else
{
- LL_WARNS() << "Couldn't find outfit " <<name<< " in wearOutfitByName()"
- << LL_ENDL;
+ error_msg = stringize("Couldn't find outfit ", std::quoted(name));
+ LL_WARNS() << error_msg << LL_ENDL;
+ return false;
}
+ return true;
}
bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventoryItem *b)