aboutsummaryrefslogtreecommitdiffstats
path: root/scoretbl.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-03-27 05:48:07 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-03-27 05:48:07 +0000
commitc3aadb29c59e52d4a7cca3a1dc269a3c388695ff (patch)
tree70717210b8c0eca3805aac26f8c3d814b4f46247 /scoretbl.c
parenta809fe7de5acf2bfd4bfe223b33d49b6daf67afb (diff)
downloadgrv-c3aadb29c59e52d4a7cca3a1dc269a3c388695ff.tar.gz
grv-c3aadb29c59e52d4a7cca3a1dc269a3c388695ff.tar.xz
grv-c3aadb29c59e52d4a7cca3a1dc269a3c388695ff.zip
Fix lots of little bugs
Diffstat (limited to 'scoretbl.c')
-rw-r--r--scoretbl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/scoretbl.c b/scoretbl.c
index 3f74fae..4ccfd3d 100644
--- a/scoretbl.c
+++ b/scoretbl.c
@@ -38,6 +38,7 @@ int highscore_add_total(uint64_t gameid, int64_t score,
if ( pptr ) *pptr = tp->player;
return i+1;
} else if ( gameid == tp->gameid && score == tp->score ) {
+ if ( pptr ) *pptr = tp->player;
return i+1;
}
}
@@ -173,7 +174,7 @@ void highscore_parse(FILE *f)
if ( sscanf(line, "TS %llx %lld %d %[0-9a-f]",
&gameid, &score, &lvl, pname) == 4 ) {
- highscore_add_total(gameid, score, lvl, &pptr);
+ highscore_add_total(gameid, score, lvl-1, &pptr);
if ( pptr ) {
strncpy(pptr, unquote(pname), PLAYER_LEN+1);
pptr[PLAYER_LEN] = '\0';
@@ -200,7 +201,7 @@ int highscore_write(FILE *f)
for ( i = 0 ; i < MAX_BEST ; i++ ) {
if ( bests.total[i].score ) {
fprintf(f, "TS %llx %lld %d %s\n", bests.total[i].gameid,
- bests.total[i].score, bests.total[i].endlvl,
+ bests.total[i].score, bests.total[i].endlvl+1,
quote(bests.total[i].player));
}
}