Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
24e9e996
Commit
24e9e996
authored
Sep 11, 2009
by
Stefan Monnier
Browse files
(main): Sort scores before trimming them,
reported by Jason Feng <jfeng@ozbert.com> (bug#4397).
parent
2efb64a8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
lib-src/ChangeLog
lib-src/ChangeLog
+5
-0
lib-src/update-game-score.c
lib-src/update-game-score.c
+3
-3
No files found.
lib-src/ChangeLog
View file @
24e9e996
2009-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
* update-game-score.c (main): Sort scores before trimming them,
reported by Jason Feng <jfeng@ozbert.com> (bug#4397).
2009-09-09 Glenn Morris <rgm@gnu.org>
2009-09-09 Glenn Morris <rgm@gnu.org>
* Makefile.in ($(DESTDIR)${archlibdir}): Set umask to world-readable
* Makefile.in ($(DESTDIR)${archlibdir}): Set umask to world-readable
...
...
lib-src/update-game-score.c
View file @
24e9e996
...
@@ -254,6 +254,7 @@ main (argc, argv)
...
@@ -254,6 +254,7 @@ main (argc, argv)
lose_syserr
(
"Failed to read scores file"
);
lose_syserr
(
"Failed to read scores file"
);
}
}
push_score
(
&
scores
,
&
scorecount
,
newscore
,
user_id
,
newdata
);
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
/* Limit the number of scores. If we're using reverse sorting, then
we should increment the beginning of the array, to skip over the
we should increment the beginning of the array, to skip over the
*smallest* scores. Otherwise, we just decrement the number of
*smallest* scores. Otherwise, we just decrement the number of
...
@@ -262,7 +263,6 @@ main (argc, argv)
...
@@ -262,7 +263,6 @@ main (argc, argv)
scorecount
-=
(
scorecount
-
MAX_SCORES
);
scorecount
-=
(
scorecount
-
MAX_SCORES
);
if
(
reverse
)
if
(
reverse
)
scores
+=
(
scorecount
-
MAX_SCORES
);
scores
+=
(
scorecount
-
MAX_SCORES
);
sort_scores
(
scores
,
scorecount
,
reverse
);
if
(
write_scores
(
scorefile
,
scores
,
scorecount
)
<
0
)
if
(
write_scores
(
scorefile
,
scores
,
scorecount
)
<
0
)
{
{
unlock_file
(
scorefile
,
lockstate
);
unlock_file
(
scorefile
,
lockstate
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment