Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viewer-private#396 Use benefits for picks count #3539

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions indra/newview/llagentpicksinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "llagentpicksinfo.h"

#include "llagent.h"
#include "llagentbenefits.h"
#include "llavatarpropertiesprocessor.h"

const S32 MAX_AVATAR_PICKS = 10;
Expand Down Expand Up @@ -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)
{
}

Expand All @@ -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();
}
Expand Down
12 changes: 3 additions & 9 deletions indra/newview/llagentpicksinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ class LLAgentPicksInfo : public LLSingleton<LLAgentPicksInfo>
/**
* 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
Expand All @@ -83,15 +83,9 @@ class LLAgentPicksInfo : public LLSingleton<LLAgentPicksInfo>
*/
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;
};

Expand Down
Loading