aboutsummaryrefslogtreecommitdiff
path: root/scores.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-04-01 19:23:14 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2020-04-01 19:23:14 -0500
commitb70bdd1804f4b993044aee99cd75bdede7a3cbd6 (patch)
tree0ee66dd5a3865697a5de76a0387971f6777dc6d8 /scores.c
parent0496bfb6bf86784242246b218b4d663367ee0e7b (diff)
downloadgemworm-b70bdd1804f4b993044aee99cd75bdede7a3cbd6.zip
gemworm-b70bdd1804f4b993044aee99cd75bdede7a3cbd6.tar.gz
High scores now work on Atari GEM after fixing some dumb mistakes
Diffstat (limited to 'scores.c')
-rw-r--r--scores.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/scores.c b/scores.c
index 11a983f..aa3975c 100644
--- a/scores.c
+++ b/scores.c
@@ -82,16 +82,16 @@ void load_scores(const char *fullpath)
char *filename;
FILE *fp;
int i;
-char scorebuf[8];
+char linebuf[16];
filename = get_hi_score_filepath(fullpath);
fp = fopen(filename, "r");
if(fp != NULL) {
for(i=0;i<10;i++) {
- memset(scorebuf, 0, 8);
- fread(scores[i].initials, 1, 3, fp);
- fgets(scorebuf, 8, fp);
- scores[i].score = atoi(scorebuf);
+ fgets(linebuf, 16, fp);
+ memcpy(scores[i].initials, linebuf, 3);
+ scores[i].initials[3] = '\0';
+ scores[i].score = atoi(&linebuf[3]);
}
scores[i].initials[3] = '\0';
fclose(fp);