viewer-private#396 Use benefits for picks count

master
Andrey Kleshchev 2025-02-12 18:29:42 +02:00 committed by Andrey Kleshchev
parent bec382698b
commit 646d0779bd
2 changed files with 12 additions and 12 deletions

View File

@ -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 @@ private:
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();
}

View File

@ -52,17 +52,17 @@ public:
/**
* 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 @@ private:
*/
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;
};