summaryrefslogtreecommitdiff
path: root/lib-src/update-game-score.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2009-09-11 19:11:07 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2009-09-11 19:11:07 +0000
commit24e9e99693f9c9425a41fd1d879ef2827523537c (patch)
tree4ca47079079216d2b8e7a847421f4f88c6e1e27b /lib-src/update-game-score.c
parent2efb64a86a51d47f8f23418bbdfd20b11e3bae91 (diff)
downloademacs-24e9e99693f9c9425a41fd1d879ef2827523537c.tar.gz
(main): Sort scores before trimming them,
reported by Jason Feng <jfeng@ozbert.com> (bug#4397).
Diffstat (limited to 'lib-src/update-game-score.c')
-rw-r--r--lib-src/update-game-score.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index d85f426cbf6..e4ddb79247f 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -254,15 +254,15 @@ main (argc, argv)
lose_syserr ("Failed to read scores file");
}
push_score (&scores, &scorecount, newscore, user_id, newdata);
+ sort_scores (scores, scorecount, reverse);
/* Limit the number of scores. If we're using reverse sorting, then
we should increment the beginning of the array, to skip over the
*smallest* scores. Otherwise, we just decrement the number of
scores, since the smallest will be at the end. */
if (scorecount > MAX_SCORES)
scorecount -= (scorecount - MAX_SCORES);
- if (reverse)
- scores += (scorecount - MAX_SCORES);
- sort_scores (scores, scorecount, reverse);
+ if (reverse)
+ scores += (scorecount - MAX_SCORES);
if (write_scores (scorefile, scores, scorecount) < 0)
{
unlock_file (scorefile, lockstate);