Skip to content

Commit

Permalink
prevent duplicate goals from being added/created
Browse files Browse the repository at this point in the history
i have intentionally only added a check when adding new goals, and not when reading goals from existing save files

this is to avoid unwanted or unintended profile altering consequences that might arise from a lack of testing

check prevents only duplicate score/rate combinations and doesn't bother considering other metadata
  • Loading branch information
MinaciousGrace committed Jul 8, 2018
1 parent 50d0775 commit 0d0402e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,11 +1225,17 @@ void Profile::ImportScoresToEtterna() {



// more future goalman stuff
// more future goalman stuff (perhaps this should be standardized to "add" in order to match scoreman nomenclature) -mina
void Profile::CreateGoal(const string& ck) {
ScoreGoal goal;
goal.timeassigned = DateTime::GetNowDateTime();
goal.rate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;

// duplication avoidance should be simpler than this? -mina
for (auto& n : goalmap[ck].goals)
if (n.rate == goal.rate && n.percent == goal.percent)
return;

goalmap[ck].Add(goal);
}

Expand Down

0 comments on commit 0d0402e

Please sign in to comment.