comparison urogue/main.c @ 263:08057be02f47

UltraRogue: make scorefile location configurable.
author John "Elwin" Edwards
date Wed, 15 Feb 2017 20:38:12 -0500
parents 096d3cfd9afd
children 4ab49e42dd6a
comparison
equal deleted inserted replaced
262:c7c6c5a7d840 263:08057be02f47
25 #include <stdlib.h> 25 #include <stdlib.h>
26 #include <errno.h> 26 #include <errno.h>
27 #include "rogue.h" 27 #include "rogue.h"
28 28
29 #define SAVEDIR "." 29 #define SAVEDIR "."
30 #define SCOREFILE "/var/local/games/roguelike/urogue.scr"
30 31
31 FILE *fd_score = NULL; 32 FILE *fd_score = NULL;
32 33
33 /* Command line options */ 34 /* Command line options */
34 35
92 argv += (x - 1); 93 argv += (x - 1);
93 } 94 }
94 95
95 /* Get default score file */ 96 /* Get default score file */
96 97
98 #ifdef SCOREFILE
99 strncpy(score_file, SCOREFILE, 2*LINELEN);
100 score_file[2*LINELEN - 1] = '\0';
101 #else
97 strcpy(score_file, "urogue.scr"); 102 strcpy(score_file, "urogue.scr");
103 #endif
98 104
99 fd_score = fopen(score_file, "r+"); 105 fd_score = fopen(score_file, "r+");
100 106
101 if (fd_score == NULL) 107 if (fd_score == NULL)
102 fd_score = fopen(score_file, "a+"); 108 fd_score = fopen(score_file, "a+");
109
110 if (!use_savedir)
111 md_normaluser();
103 112
104 if ((env = getenv("OPTIONS")) != NULL) 113 if ((env = getenv("OPTIONS")) != NULL)
105 parse_opts(env); 114 parse_opts(env);
106 115
107 if (!use_savedir) { 116 if (!use_savedir) {