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

@ -46,7 +46,7 @@ range(void)
char *p;
char buf[1024];
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
if (!snxtitem(&np, EF_PLANE, player->argp[1], NULL))
return RET_SYN;
while (nxtitem(&np, &plane)) {
if (!player->owner || plane.pln_own == 0)
@ -79,7 +79,7 @@ lrange(void)
char prompt[128];
char buf[1024];
if (!snxtitem(&np, EF_LAND, player->argp[1]))
if (!snxtitem(&np, EF_LAND, player->argp[1], NULL))
return RET_SYN;
while (nxtitem(&np, &land)) {
if (!player->owner || land.lnd_own == 0)