diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index e2a2d2d8a9..265e4060ff 100644 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -28,6 +28,7 @@ #include "llagentpicksinfo.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llavatarpropertiesprocessor.h" const S32 MAX_AVATAR_PICKS = 10; @@ -85,10 +86,9 @@ class LLAgentPicksInfo::LLAgentPicksObserver : public LLAvatarPropertiesObserver LLAgentPicksInfo::LLAgentPicksInfo() : mAgentPicksObserver(NULL) - , mMaxNumberOfPicks(MAX_AVATAR_PICKS) // Disable Pick creation until we get number of Picks from server - in case // avatar has maximum number of Picks. - , mNumberOfPicks(mMaxNumberOfPicks) + , mNumberOfPicks(S32_MAX) { } @@ -110,7 +110,13 @@ void LLAgentPicksInfo::requestNumberOfPicks() mAgentPicksObserver->sendAgentPicksRequest(); } -bool LLAgentPicksInfo::isPickLimitReached() +// static +S32 LLAgentPicksInfo::getMaxNumberOfPicks() +{ + return LLAgentBenefitsMgr::current().getPicksLimit(); +} + +bool LLAgentPicksInfo::isPickLimitReached() const { return getNumberOfPicks() >= getMaxNumberOfPicks(); } diff --git a/indra/newview/llagentpicksinfo.h b/indra/newview/llagentpicksinfo.h index 9bc105a655..3514ade65d 100644 --- a/indra/newview/llagentpicksinfo.h +++ b/indra/newview/llagentpicksinfo.h @@ -52,17 +52,17 @@ class LLAgentPicksInfo : public LLSingleton /** * Returns number of Picks. */ - S32 getNumberOfPicks() { return mNumberOfPicks; } + S32 getNumberOfPicks() const { return mNumberOfPicks; } /** * Returns maximum number of Picks. */ - S32 getMaxNumberOfPicks() { return mMaxNumberOfPicks; } + static S32 getMaxNumberOfPicks(); /** * Returns true if Agent has maximum allowed number of Picks. */ - bool isPickLimitReached(); + bool isPickLimitReached() const; /** * After creating or deleting a Pick we can assume operation on server will be @@ -83,15 +83,9 @@ class LLAgentPicksInfo : public LLSingleton */ void setNumberOfPicks(S32 number) { mNumberOfPicks = number; } - /** - * Sets maximum number of Picks. - */ - void setMaxNumberOfPicks(S32 max_picks) { mMaxNumberOfPicks = max_picks; } - private: LLAgentPicksObserver* mAgentPicksObserver; - S32 mMaxNumberOfPicks; S32 mNumberOfPicks; };