From 8690ea40f34752ba47187f0f09ec7a65c75faa8f Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Sun, 19 Feb 2017 19:47:09 -0500 Subject: [PATCH] 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. --- urogue/getplay.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/urogue/getplay.c b/urogue/getplay.c index 88010c7..ccc1657 100644 --- a/urogue/getplay.c +++ b/urogue/getplay.c @@ -16,6 +16,8 @@ #include #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) ) {