UltraRogue: make scorefile location configurable.
This commit is contained in:
parent
a8a6e1ce7a
commit
d309fcdd46
3 changed files with 12 additions and 1 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#include "rogue.h"
|
#include "rogue.h"
|
||||||
|
|
||||||
#define SAVEDIR "."
|
#define SAVEDIR "."
|
||||||
|
#define SCOREFILE "/var/local/games/roguelike/urogue.scr"
|
||||||
|
|
||||||
FILE *fd_score = NULL;
|
FILE *fd_score = NULL;
|
||||||
|
|
||||||
|
|
@ -94,13 +95,21 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Get default score file */
|
/* Get default score file */
|
||||||
|
|
||||||
|
#ifdef SCOREFILE
|
||||||
|
strncpy(score_file, SCOREFILE, 2*LINELEN);
|
||||||
|
score_file[2*LINELEN - 1] = '\0';
|
||||||
|
#else
|
||||||
strcpy(score_file, "urogue.scr");
|
strcpy(score_file, "urogue.scr");
|
||||||
|
#endif
|
||||||
|
|
||||||
fd_score = fopen(score_file, "r+");
|
fd_score = fopen(score_file, "r+");
|
||||||
|
|
||||||
if (fd_score == NULL)
|
if (fd_score == NULL)
|
||||||
fd_score = fopen(score_file, "a+");
|
fd_score = fopen(score_file, "a+");
|
||||||
|
|
||||||
|
if (!use_savedir)
|
||||||
|
md_normaluser();
|
||||||
|
|
||||||
if ((env = getenv("OPTIONS")) != NULL)
|
if ((env = getenv("OPTIONS")) != NULL)
|
||||||
parse_opts(env);
|
parse_opts(env);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1811,6 +1811,7 @@ long md_random(void);
|
||||||
void md_srandom(long seed);
|
void md_srandom(long seed);
|
||||||
int md_readchar(WINDOW *win);
|
int md_readchar(WINDOW *win);
|
||||||
int md_getuid(void);
|
int md_getuid(void);
|
||||||
|
void md_normaluser(void);
|
||||||
|
|
||||||
#define NOOP(x) (x += 0)
|
#define NOOP(x) (x += 0)
|
||||||
#define CCHAR(x) ( (char) (x & A_CHARTEXT) )
|
#define CCHAR(x) ( (char) (x & A_CHARTEXT) )
|
||||||
|
|
|
||||||
|
|
@ -1436,6 +1436,7 @@ restore_file(FILE *savef)
|
||||||
// The file_name stored in the file no longer replaces its actual name.
|
// The file_name stored in the file no longer replaces its actual name.
|
||||||
ur_free(str);
|
ur_free(str);
|
||||||
str = ur_read_string(savef);
|
str = ur_read_string(savef);
|
||||||
|
if (!use_savedir)
|
||||||
strcpy(score_file,str);
|
strcpy(score_file,str);
|
||||||
ur_free(str);
|
ur_free(str);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue