comparison arogue5/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 56e748983fa8
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 <fcntl.h> 18 #include <fcntl.h>
19 #include <sys/types.h>
20 #include <sys/stat.h> 19 #include <sys/stat.h>
21 #include <limits.h> 20 #include <limits.h>
22 #include <signal.h> 21 #include <signal.h>
23 #include <time.h> 22 #include <time.h>
24 #include "mach_dep.h" 23 #include "mach_dep.h"
41 "jellybean", "apple", "strawberry", "blueberry", 40 "jellybean", "apple", "strawberry", "blueberry",
42 "peach", "banana" 41 "peach", "banana"
43 }; 42 };
44 #define NFRUIT (sizeof(funfruit) / sizeof (char *)) 43 #define NFRUIT (sizeof(funfruit) / sizeof (char *))
45 44
46 int scorefd = -1;
47 FILE *logfile = NULL;
48 void open_records(void); 45 void open_records(void);
49 46
50 main(argc, argv, envp) 47 main(argc, argv, envp)
51 char **argv; 48 char **argv;
52 char **envp; 49 char **envp;
253 250
254 void 251 void
255 open_records(void) 252 open_records(void)
256 { 253 {
257 if (scorefd == -1) 254 if (scorefd == -1)
258 scorefd = open(score_file, O_RDWR | O_CREAT, 0666); 255 md_reopen_score();
259 #ifdef LOGFILE 256 #ifdef LOGFILE
260 if (logfile == NULL) 257 if (logfile == NULL)
261 logfile = fopen(LOGFILE, "a"); 258 logfile = fopen(LOGFILE, "a");
262 #endif 259 #endif
263 return; 260 return;