Skip to content

Commit e0f53c5

Browse files
be a little less bad with dealing with map key checks
1 parent 0290698 commit e0f53c5

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

src/Profile.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,11 +2446,6 @@ HighScore& Profile::GetPBHighScoreByKey(RString ck, float rate) {
24462446
return HighScoresByChartKey.at(ck).at(rate).at(0);
24472447
}
24482448

2449-
bool Profile::ChartkeyHasGoal(RString ck) {
2450-
auto it = goalmap.find(ck);
2451-
return it != goalmap.end();
2452-
}
2453-
24542449
// aaa too lazy to write comparators rn -mina
24552450
ScoreGoal& Profile::GetLowestGoalForRate(RString ck, float rate) {
24562451
auto& sgv = goalmap[ck];
@@ -2469,7 +2464,7 @@ ScoreGoal& Profile::GetLowestGoalForRate(RString ck, float rate) {
24692464
}
24702465

24712466
void Profile::SetAnyAchievedGoals(RString ck, float rate, const HighScore& pscore) {
2472-
if (!ChartkeyHasGoal(ck))
2467+
if (!HasGoal(ck))
24732468
return;
24742469

24752470
auto& sgv = goalmap[ck];

src/Profile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class Profile
280280
void CreateGoal(RString ck);
281281
void DeleteGoal(RString ck, DateTime assigned);
282282
map<RString, vector<ScoreGoal>> goalmap;
283-
bool ChartkeyHasGoal(RString ck);
283+
bool HasGoal(RString ck) { return goalmap.count(ck) == 1; }
284284
ScoreGoal& GetLowestGoalForRate(RString ck, float rate);
285285
void SetAnyAchievedGoals(RString ck, float rate, const HighScore& pscore);
286286

0 commit comments

Comments
 (0)