File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ data::SavedGame loadSavedGame(
102
102
103
103
104
104
data::HighScoreList loadHighScoreList (const std::string& filename) {
105
+ using std::begin;
106
+ using std::end;
107
+ using std::sort;
108
+
105
109
data::HighScoreList list;
106
110
107
111
const auto data = loadFile (filename);
@@ -112,7 +116,7 @@ data::HighScoreList loadHighScoreList(const std::string& filename) {
112
116
list[i].mScore = std::min<std::uint32_t >(reader.readU32 (), data::MAX_SCORE);
113
117
}
114
118
115
- // TODO: Ensure the list is sorted
119
+ sort ( begin ( list), end (list));
116
120
return list;
117
121
}
118
122
Original file line number Diff line number Diff line change @@ -244,6 +244,10 @@ void UserProfile::saveToDisk() {
244
244
245
245
246
246
void UserProfile::loadFromDisk () {
247
+ using std::begin;
248
+ using std::end;
249
+ using std::sort;
250
+
247
251
if (!mProfilePath ) {
248
252
return ;
249
253
}
@@ -289,7 +293,7 @@ void UserProfile::loadFromDisk() {
289
293
}
290
294
}
291
295
292
- // TODO: Ensure the list is sorted
296
+ sort ( begin ( mHighScoreLists [i]), end ( mHighScoreLists [i]));
293
297
294
298
++i;
295
299
if (i >= mHighScoreLists .size ()) {
You can’t perform that action at this time.
0 commit comments