Mercurial > hg > early-roguelike
diff srogue/options.c @ 37:34d7a614855e
srogue: add support for SAVEDIR
author | elwin |
---|---|
date | Thu, 25 Nov 2010 17:28:29 +0000 |
parents | 2128c7dc8a40 |
children | 8a9525231fb6 |
line wrap: on
line diff
--- a/srogue/options.c Thu Nov 25 12:21:41 2010 +0000 +++ b/srogue/options.c Thu Nov 25 17:28:29 2010 +0000 @@ -185,6 +185,9 @@ continue; len = sp - str; for (op = optlist; op < &optlist[NUM_OPTS]; op++) { + /* For security, some options can't be changed. */ + if (!allowchange(op)) + continue; if (EQSTR(str, op->o_name, len)) { reg char *start; @@ -228,3 +231,14 @@ } *s1 = '\0'; } + +int allowchange(OPTION *opt) +{ + if (!use_savedir) + return 1; + if (!strcmp(opt->o_name, "name")) + return 0; + if (!strcmp(opt->o_name, "file")) + return 0; + return 1; +}