Mercurial > hg > early-roguelike
comparison arogue7/main.c @ 145:aac28331e71d
Advanced Rogue family: fix the "score" option.
Changing the score file (when permitted) now works again, closing the
old score file and opening the new one.
author | John "Elwin" Edwards |
---|---|
date | Wed, 20 May 2015 08:42:17 -0400 |
parents | 7faf4568c295 |
children | 301ed6992c2e |
comparison
equal
deleted
inserted
replaced
144:708bb2dea17c | 145:aac28331e71d |
---|---|
14 | 14 |
15 #include "curses.h" | 15 #include "curses.h" |
16 #include <stdlib.h> | 16 #include <stdlib.h> |
17 #include <string.h> | 17 #include <string.h> |
18 #include <signal.h> | 18 #include <signal.h> |
19 #include <sys/types.h> | |
20 #include <fcntl.h> | |
21 #ifdef BSD | 19 #ifdef BSD |
22 #include <sys/time.h> | 20 #include <sys/time.h> |
23 #else | 21 #else |
24 #include <time.h> | 22 #include <time.h> |
25 #endif | 23 #endif |
31 #include <ctype.h> | 29 #include <ctype.h> |
32 extern struct uwdata wdata, oldwin; | 30 extern struct uwdata wdata, oldwin; |
33 extern char oldtext[WTXTNUM][WTXTLEN]; | 31 extern char oldtext[WTXTNUM][WTXTLEN]; |
34 #endif | 32 #endif |
35 | 33 |
36 int scorefd = -1; | |
37 FILE *logfile = NULL; | |
38 void open_records(void); | 34 void open_records(void); |
39 | 35 |
40 main(argc, argv, envp) | 36 main(argc, argv, envp) |
41 char **argv; | 37 char **argv; |
42 char **envp; | 38 char **envp; |
551 | 547 |
552 void | 548 void |
553 open_records(void) | 549 open_records(void) |
554 { | 550 { |
555 if (scorefd == -1) | 551 if (scorefd == -1) |
556 scorefd = open(score_file, O_RDWR | O_CREAT, 0666); | 552 md_reopen_score(); |
557 #ifdef LOGFILE | 553 #ifdef LOGFILE |
558 if (logfile == NULL) | 554 if (logfile == NULL) |
559 logfile = fopen(LOGFILE, "a"); | 555 logfile = fopen(LOGFILE, "a"); |
560 #endif | 556 #endif |
561 return; | 557 return; |