(ef_byname_from): New.

(set, mission, multifire, fuel, cons_choose, cede): Use it instead of
ef_byname().  Remove the hacks to map unwanted results to wanted
results.  The hacks in set() were broken: bad input made the code cast
arbitrary items to union trdgenstr, with potentially disastrous
consequences.  Closes #906483 and #906486.

(set): Less cryptic prompt and diagnostics.
This commit is contained in:
Markus Armbruster 2005-10-27 21:33:17 +00:00
parent 2df98825e9
commit 2fc1e74a72
8 changed files with 54 additions and 30 deletions

View file

@ -110,6 +110,7 @@ cons(void)
static int
cons_choose(struct ltcomstr *ltcp)
{
static int lon_or_trt[] = { EF_LOAN, EF_TREATY, EF_BAD };
s_char *p;
struct lonstr *lp;
struct trtstr *tp;
@ -119,7 +120,7 @@ cons_choose(struct ltcomstr *ltcp)
memset(ltcp, 0, sizeof(*ltcp));
if (getstarg(player->argp[1], "loan or treaty? ", buf) == 0)
return RET_SYN;
ltcp->type = ef_byname(buf);
ltcp->type = ef_byname_from(buf, lon_or_trt);
switch (ltcp->type) {
case EF_TREATY:
if (!opt_TREATIES) {