Mercurial > hg > early-roguelike
comparison urogue/getplay.c @ 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 | c495a4f288c6 |
children | 51ddbe7b992d |
comparison
equal
deleted
inserted
replaced
263:08057be02f47 | 264:778938a5c21d |
---|---|
13 | 13 |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 #include <ctype.h> | 15 #include <ctype.h> |
16 #include <string.h> | 16 #include <string.h> |
17 #include "rogue.h" | 17 #include "rogue.h" |
18 | |
19 #define CHRDIR "." | |
18 | 20 |
19 #define I_STR 0 | 21 #define I_STR 0 |
20 #define I_INTEL 1 | 22 #define I_INTEL 1 |
21 #define I_WISDOM 2 | 23 #define I_WISDOM 2 |
22 #define I_DEXT 3 | 24 #define I_DEXT 3 |
34 { | 36 { |
35 const char *home; | 37 const char *home; |
36 | 38 |
37 home = getenv("HOME"); | 39 home = getenv("HOME"); |
38 | 40 |
41 #ifdef CHRDIR | |
42 if (use_savedir) | |
43 { | |
44 strncpy(filename, CHRDIR, size); | |
45 filename[size-1] = '\0'; | |
46 snprintf(filename, size, "%s/%d-%.80s.chr", CHRDIR, md_getuid(), | |
47 whoami); | |
48 return; | |
49 } | |
50 #endif | |
39 if (home) { | 51 if (home) { |
40 if ((int)strlen(home) < (size - 12) ) | 52 if ((int)strlen(home) < (size - 12) ) |
41 { | 53 { |
42 strcpy(filename, home); | 54 strcpy(filename, home); |
43 strcat(filename,"/urogue.chr"); | 55 strcat(filename,"/urogue.chr"); |