Turn options into ordinary econfig keys:

(configkeys): Add options.
(KM_OPTION): New.
(vers): Find options in configkeys[] instead of Options[].
(xdump): Remove xdump opt syntax.
(xdopt): Remove.
(emp_config, print_config): Remove option special case.
(option_list, Options, setoption): Remove.
This commit is contained in:
Markus Armbruster 2005-12-25 10:32:50 +00:00
parent 373a08a0e0
commit ade510f787
7 changed files with 86 additions and 173 deletions

View file

@ -177,21 +177,24 @@ show_opts(int val)
{
int col;
char *sep;
struct option_list *op;
struct keymatch *kp;
sep = "";
col = 0;
for (op = Options; op->opt_key; op++) {
if (!*op->opt_valuep != !val)
for (kp = configkeys; kp->km_key; kp++) {
if (!(kp->km_flags & KM_OPTION))
continue;
col += strlen(sep) + strlen(op->opt_key);
if (CANT_HAPPEN(kp->km_type != NSC_INT))
continue;
if (!*(int *)kp->km_data != !val)
continue;
col += strlen(sep) + strlen(kp->km_key);
if (col > 70) {
pr(",\n ");
sep = "";
col = strlen(op->opt_key);
col = strlen(kp->km_key);
}
pr("%s%s", sep, op->opt_key);
pr("%s%s", sep, kp->km_key);
sep = ", ";
}

View file

@ -56,7 +56,6 @@
* - News item characteristics: rpt[]
* - News page headings: page_headings[] (TODO)
* - Commands: player_coms[] (TODO)
* - Options: Options[]
* - Configuration: configkeys[]
*
* Dynamic game data:
@ -247,46 +246,6 @@ xdmeta(int type)
return RET_OK;
}
/*
* Dump Options[], return RET_OK.
* If META, dump meta-data rather than data.
*/
static int
xdopt(int meta)
{
int i;
char *sep;
struct castr ca;
xdhdr("options", meta);
if (meta) {
for (i = 0; Options[i].opt_key; ++i) {
ca.ca_type = NSC_INT;
ca.ca_flags = 0;
ca.ca_len = 0;
ca.ca_off = 0;
ca.ca_name = Options[i].opt_key;
ca.ca_table = EF_BAD;
xdflds(mdchr_ca, &ca);
pr("\n");
}
xdftr(i);
return RET_OK;
}
sep = "";
for (i = 0; Options[i].opt_key; ++i) {
pr("%s%d", sep, *Options[i].opt_valuep);
sep = " ";
}
pr("\n");
xdftr(1);
return RET_OK;
}
/*
* Dump configkeys[], return RET_OK.
* If META, dump meta-data rather than data.
@ -363,8 +322,6 @@ xdump(void)
return xdmeta(type);
else
return xditem(type, player->argp[2]);
} else if (!strncmp(p, "opt", strlen(p))) {
return xdopt(meta);
} else if (!strncmp(p, "ver", strlen(p))) {
return xdver(meta);
}