UltraRogue: add location for character files.

When using the -n option, UltraRogue will look for character files in a
single location, similar to save files.

The location is chosen by defining CHRDIR in getplay.c, at least until
UltraRogue gets integrated with the build systems.
This commit is contained in:
John "Elwin" Edwards 2017-02-19 19:47:09 -05:00
parent d309fcdd46
commit 8690ea40f3

View file

@ -16,6 +16,8 @@
#include <string.h>
#include "rogue.h"
#define CHRDIR "."
#define I_STR 0
#define I_INTEL 1
#define I_WISDOM 2
@ -36,6 +38,16 @@ static void get_chr_filename(char *filename, int size)
home = getenv("HOME");
#ifdef CHRDIR
if (use_savedir)
{
strncpy(filename, CHRDIR, size);
filename[size-1] = '\0';
snprintf(filename, size, "%s/%d-%.80s.chr", CHRDIR, md_getuid(),
whoami);
return;
}
#endif
if (home) {
if ((int)strlen(home) < (size - 12) )
{