Mercurial > hg > early-roguelike
changeset 264:778938a5c21d
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.
author | John "Elwin" Edwards |
---|---|
date | Sun, 19 Feb 2017 19:47:09 -0500 |
parents | 08057be02f47 |
children | 7fcb2f9f57e6 |
files | urogue/getplay.c |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/urogue/getplay.c Wed Feb 15 20:38:12 2017 -0500 +++ b/urogue/getplay.c Sun Feb 19 19:47:09 2017 -0500 @@ -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 @@ 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) ) {