Skip to content

Commit

Permalink
be a little less bad with dealing with map key checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 30, 2017
1 parent 0290698 commit e0f53c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2446,11 +2446,6 @@ HighScore& Profile::GetPBHighScoreByKey(RString ck, float rate) {
return HighScoresByChartKey.at(ck).at(rate).at(0);
}

bool Profile::ChartkeyHasGoal(RString ck) {
auto it = goalmap.find(ck);
return it != goalmap.end();
}

// aaa too lazy to write comparators rn -mina
ScoreGoal& Profile::GetLowestGoalForRate(RString ck, float rate) {
auto& sgv = goalmap[ck];
Expand All @@ -2469,7 +2464,7 @@ ScoreGoal& Profile::GetLowestGoalForRate(RString ck, float rate) {
}

void Profile::SetAnyAchievedGoals(RString ck, float rate, const HighScore& pscore) {
if (!ChartkeyHasGoal(ck))
if (!HasGoal(ck))
return;

auto& sgv = goalmap[ck];
Expand Down
2 changes: 1 addition & 1 deletion src/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Profile
void CreateGoal(RString ck);
void DeleteGoal(RString ck, DateTime assigned);
map<RString, vector<ScoreGoal>> goalmap;
bool ChartkeyHasGoal(RString ck);
bool HasGoal(RString ck) { return goalmap.count(ck) == 1; }
ScoreGoal& GetLowestGoalForRate(RString ck, float rate);
void SetAnyAchievedGoals(RString ck, float rate, const HighScore& pscore);

Expand Down

0 comments on commit e0f53c5

Please sign in to comment.