Skip to content

Commit

Permalink
add a profile function for setting any scoregoals fulfilled by a high…
Browse files Browse the repository at this point in the history
…score object as achieved

add a profile function to get the lowest percentage scoregoal for during-gameplay tracking
  • Loading branch information
MinaciousGrace committed Apr 30, 2017
1 parent 31540e1 commit 4f10ee9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2442,6 +2442,35 @@ float Profile::GetWifePBByKey(RString key) {
return o;
}

// aaa too lazy to write comparators rn -mina
ScoreGoal& Profile::GetLowestGoalForRate(RString ck, float rate) {
auto& sgv = goalmap[ck];
float lowest = 100.f;
int lowestidx = 0;
for (size_t i = 0; i < sgv.size(); ++i) {
ScoreGoal& tmp = sgv[i];
if (tmp.rate == rate) {
if (tmp.percent > lowest) {
lowest = tmp.percent;
lowestidx = i;
}
}
}
ScoreGoal o = sgv[lowestidx];
return o;
}

void Profile::SetAnyAchievedGoals(RString ck, float rate, const HighScore& pscore) {
auto& sgv = goalmap[ck];
for (size_t i = 0; i < sgv.size(); ++i) {
ScoreGoal& tmp = sgv[i];
if (tmp.percent < pscore.GetWifeScore() * 100.f) {
tmp.achieved = true;
tmp.timeachieved = pscore.GetDateTime();
}
}
}

// also finish dealing with this later - mina
void Profile::CalcPlayerRating(float& prating, float* pskillsets) const {
vector<float> demskillas[NUM_Skillset];
Expand Down
4 changes: 3 additions & 1 deletion src/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,11 @@ class Profile
// Vector for now, we can make this more efficient later
vector<RString> FavoritedCharts;

// more future goalman stuff
// more future goalman stuff -mina
void CreateGoal(RString ck);
map<RString, vector<ScoreGoal>> goalmap;
ScoreGoal& GetLowestGoalForRate(RString ck, float rate);
void SetAnyAchievedGoals(RString ck, float rate, const HighScore& pscore);

/* store arbitrary data for the theme within a profile */
LuaTable m_UserTable;
Expand Down

0 comments on commit 4f10ee9

Please sign in to comment.