(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:
parent
2df98825e9
commit
2fc1e74a72
8 changed files with 54 additions and 30 deletions
|
@ -55,6 +55,7 @@
|
|||
int
|
||||
mission(void)
|
||||
{
|
||||
static int ef_with_missions[] = { EF_SHIP, EF_LAND, EF_PLANE, EF_BAD };
|
||||
s_char *p;
|
||||
int type;
|
||||
int mission;
|
||||
|
@ -72,10 +73,8 @@ mission(void)
|
|||
getstarg(player->argp[1], "Ship, plane or land unit (p,sh,la)? ",
|
||||
buf)) == 0)
|
||||
return RET_SYN;
|
||||
type = ef_byname(p);
|
||||
if (type == EF_SECTOR)
|
||||
type = EF_SHIP;
|
||||
if (type != EF_SHIP && type != EF_LAND && type != EF_PLANE) {
|
||||
type = ef_byname_from(p, ef_with_missions);
|
||||
if (type < 0) {
|
||||
pr("Ships, land units or planes only! (s, l, p)\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue