Fix extra prompt after abort due to misuse of snxtitem()

The old code used getstarg() to get an argument with a different
prompt than snxtitem() uses, then passed the value to snxtitem()
unchecked.  If the player aborts, getstarg() returns a null pointer,
and snxtitem() prompts again.  Affected:

* load/lload plane/land third argument; load_plane_ship(),
  load_land_ship(), load_plane_land(), load_land_land()

* bomb, drop, fly, paradrop, recon and sweep second argument;
  get_planes()

* tend and ltend second and fourth argument; ltend(), tend(),
  tend_land()

* mission second argument; mission()

Fix by making snxtitem() taking a prompt argument, null pointer
requests the old prompt.

Use that to simplify multifire() and torp().  Change the other callers
to pass NULL.
This commit is contained in:
Markus Armbruster 2008-07-26 21:35:00 -04:00
parent 9f4ce71a54
commit 3cc8de8aef
67 changed files with 108 additions and 113 deletions

View file

@ -80,8 +80,7 @@ tend(void)
return RET_SYN;
}
if (!snxtitem(&tenders, EF_SHIP,
getstarg(player->argp[2], "Tender(s)? ", buf)))
if (!snxtitem(&tenders, EF_SHIP, player->argp[2], "Tender(s)? "))
return RET_SYN;
while (nxtitem(&tenders, &tender)) {
@ -127,8 +126,7 @@ tend(void)
break;
}
if (!snxtitem(&targets, EF_SHIP,
getstarg(player->argp[4], "Ships to be tended? ",
buf)))
player->argp[4], "Ships to be tended? "))
return RET_SYN;
if (!check_ship_ok(&tender))
return RET_SYN;
@ -213,7 +211,7 @@ tend_land(struct shpstr *tenderp, char *units)
struct nstr_item pni;
char buf[1024];
if (!snxtitem(&lni, EF_LAND, units))
if (!snxtitem(&lni, EF_LAND, units, NULL))
return RET_SYN;
while (nxtitem(&lni, &land)) {
@ -229,8 +227,7 @@ tend_land(struct shpstr *tenderp, char *units)
continue;
}
if (!snxtitem(&targets, EF_SHIP,
getstarg(player->argp[4], "Ship to be tended? ",
buf)))
player->argp[4], "Ship to be tended? "))
return RET_SYN;
if (!check_land_ok(&land))
return RET_SYN;