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:
parent
9f4ce71a54
commit
3cc8de8aef
67 changed files with 108 additions and 113 deletions
|
@ -62,13 +62,10 @@ torp(void)
|
|||
char *ptr;
|
||||
struct nstr_item nbst;
|
||||
char buf[1024];
|
||||
char *p;
|
||||
int ntorping = 0;
|
||||
char prompt[128];
|
||||
|
||||
if (!(p = getstarg(player->argp[1], "From ship(s)? ", buf)))
|
||||
return RET_SYN;
|
||||
if (!snxtitem(&nbst, EF_SHIP, p))
|
||||
if (!snxtitem(&nbst, EF_SHIP, player->argp[1], "From ship(s)? "))
|
||||
return RET_SYN;
|
||||
while (nxtitem(&nbst, &sub)) {
|
||||
if (sub.shp_own != player->cnum)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue