Skip to content

Commit 0d0402e

Browse files
prevent duplicate goals from being added/created
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
1 parent 50d0775 commit 0d0402e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Profile.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,11 +1225,17 @@ void Profile::ImportScoresToEtterna() {
12251225

12261226

12271227

1228-
// more future goalman stuff
1228+
// more future goalman stuff (perhaps this should be standardized to "add" in order to match scoreman nomenclature) -mina
12291229
void Profile::CreateGoal(const string& ck) {
12301230
ScoreGoal goal;
12311231
goal.timeassigned = DateTime::GetNowDateTime();
12321232
goal.rate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
1233+
1234+
// duplication avoidance should be simpler than this? -mina
1235+
for (auto& n : goalmap[ck].goals)
1236+
if (n.rate == goal.rate && n.percent == goal.percent)
1237+
return;
1238+
12331239
goalmap[ck].Add(goal);
12341240
}
12351241

0 commit comments

Comments
 (0)