Mercurial > hg > early-roguelike
diff srogue/rip.c @ 184:7c059ec2a2c7
Merge Super-Rogue fixes into the MSVC testing branch.
author | John "Elwin" Edwards |
---|---|
date | Sun, 02 Aug 2015 12:25:44 -0400 |
parents | 78fa1d0e5d25 |
children | f4f6734771e0 |
line wrap: on
line diff
--- a/srogue/rip.c Sat Aug 01 21:23:55 2015 -0400 +++ b/srogue/rip.c Sun Aug 02 12:25:44 2015 -0400 @@ -47,6 +47,9 @@ #define RIP_LINES (sizeof rip / (sizeof (char *))) +extern int scorefd; +extern FILE *logfile; + char *killname(); void writelog(int amount, int aflag, char monst); @@ -140,7 +143,7 @@ /* * Open file and read list */ - if ((fd = open(scorefile, O_RDWR | O_CREAT, 0666)) < 0) + if ((fd = scorefd) < 0) return; outf = (FILE *) fdopen(fd, "w"); for (scp = top_ten; scp <= &top_ten[9]; scp++) { @@ -221,11 +224,12 @@ { char logmessage[220], ltemp[80], mlev[40]; char *killer; - FILE *logfi; if (waswizard) return; #ifdef LOGFILE + if (logfile == NULL) + return; sprintf(logmessage, "%d %d %s %d ", time(NULL), amount, whoami, him->s_lvl); if (amulet) @@ -247,11 +251,8 @@ else return; strcat(logmessage, ltemp); - logfi = fopen(LOGFILE, "a"); - if (logfi == NULL) - return; - fprintf(logfi, "%s", logmessage); - fclose(logfi); + fprintf(logfile, "%s", logmessage); + fclose(logfile); #endif return; }