The old code didn't honor command abortion at the following prompts:
* arm third argument
* deliver fourth argument (also simplify)
* fire third argument
* fly and recon prompt for carrier to land on: pln_onewaymission()
treated abort like empty input, which made planes attempt landing in
the sector.
* lmine second argument
* order d fourth argument
* power c nat(s) argument
* range second argument
* sail second argument
* shutdown both arguments (first one was broken in commit
84cfd670,
v4.3.10, second one never worked).
* tend third argument
return RET_FAIL;
}
p = getstarg(player->argp[3], "Airburst [n]? ", buf);
+ if (!p)
+ return RET_SYN;
if (!check_plane_ok(&pl) || !check_nuke_ok(&nuke))
return RET_FAIL;
return RET_FAIL;
}
- if (p && (*p == 'y' || *p == 'Y'))
+ if (*p == 'y' || *p == 'Y')
pl.pln_flags |= PLN_AIRBURST;
else
pl.pln_flags &= ~PLN_AIRBURST;
if (!snxtsct(&nstr, player->argp[2]))
return RET_SYN;
- while (!player->aborted && nxtsct(&nstr, §) > 0) {
+ while (nxtsct(&nstr, §) > 0) {
if (!player->owner)
continue;
if (!(p = getstarg(player->argp[3], prompt, buf)) || !*p)
return RET_SYN;
if (*p != 'q') {
- sprintf(prompt, "%s %s %s direction? ",
- xyas(nstr.x, nstr.y, player->cnum),
- dchr[sect.sct_type].d_name, ich->i_name);
if (((*p >= '0') && (*p <= '9')) || *p == '+') {
thresh = atoi(p) & ~0x7;
if (*p == '+')
p = NULL;
else {
+ sprintf(prompt, "%s %s %s direction? ",
+ xyas(nstr.x, nstr.y, player->cnum),
+ dchr[sect.sct_type].d_name, ich->i_name);
p = getstarg(player->argp[4], prompt, buf);
+ if (!p)
+ return RET_SYN;
}
}
if (p && *p) {
if (!snxtitem(&nbst, type, ptr))
return RET_SYN;
- if (player->aborted) {
- pr("Fire aborted.\n");
- return RET_OK;
- }
while (nxtitem(&nbst, &item)) {
if (type == EF_LAND) {
if (!getland(item.land.lnd_uid, &fland))
fy = fsect.sct_y;
}
- if ((ptr = getstarg(player->argp[3], "Firing at? ", buf)) == 0
- || *ptr == '\0')
- continue;
- if (player->aborted) {
- pr("Fire aborted.\n");
+ ptr = getstarg(player->argp[3], "Firing at? ", buf);
+ if (!ptr)
+ return RET_SYN;
+ if (!*ptr)
continue;
- }
if (!issector(ptr)) {
vshipno = atoi(ptr);
if (vshipno < 0 || !getship(vshipno, &vship) ||
sect.sct_mines, xyas(sect.sct_x, sect.sct_y, player->cnum));
sprintf(prompt, "Drop how many mines from %s? ", prland(&land));
mines_wanted = onearg(player->argp[2], prompt);
- if (!check_land_ok(&land))
+ if (mines_wanted < 0)
+ return RET_SYN;
+ if (mines_wanted == 0)
continue;
- if (mines_wanted <= 0)
+ if (!check_land_ok(&land))
continue;
land.lnd_mission = 0;
total_mines_laid = 0;
if (!orders) {
p = getstarg(player->argp[4], "Second dest? ", buf);
- if (!p || !*p || !strcmp(p, "-")) {
+ if (!p)
+ return RET_SYN;
+ if (!*p || !strcmp(p, "-")) {
orders = 1;
pr("A one-way order has been accepted.\n");
} else if (!strncmp(p, "s", 1)) {
if (player->argp[i]) {
if (player->argp[i][0] == 'c') {
- snxtitem(&ni, EF_NATION, player->argp[i + 1]);
+ if (!snxtitem(&ni, EF_NATION, player->argp[i + 1]))
+ return RET_SYN;
while (nxtitem(&ni, &nat)) {
if (nat.nat_stat == STAT_UNUSED)
continue;
if (!player->owner || plane.pln_own == 0)
continue;
p = getstarg(player->argp[2], "New range? ", buf);
+ if (!p)
+ return RET_SYN;
if (!check_plane_ok(&plane))
return RET_SYN;
- if (!p || (i = atoi(p)) < 0)
+ if ((i = atoi(p)) < 0)
continue;
rmax = pln_range_max(&plane);
plane.pln_range = MIN(rmax, i);
struct shpstr ship;
char navpath[MAX_PATH_LEN];
- while (!player->aborted && nxtitem(nstr, &ship)) {
+ while (nxtitem(nstr, &ship)) {
if (!player->owner || ship.shp_own == 0)
continue;
if ((ship.shp_autonav & AN_AUTONAV) &&
xyas(ship.shp_x, ship.shp_y, ship.shp_own));
cp = getpath(navpath, player->argp[2],
ship.shp_x, ship.shp_y, 0, 0, P_SAILING);
+ if (!cp)
+ return RET_SYN;
if (!check_ship_ok(&ship))
continue;
- if (!player->aborted) {
- strncpy(ship.shp_path, cp, sizeof(ship.shp_path) - 2);
- ship.shp_mission = 0;
- putship(ship.shp_uid, &ship);
- }
+ strncpy(ship.shp_path, cp, sizeof(ship.shp_path) - 2);
+ ship.shp_mission = 0;
+ putship(ship.shp_uid, &ship);
}
return RET_OK;
}
shutdown_minutes =
onearg(player->argp[1],
"Time until shutdown in minutes (-1 to abort shutdown sequence)? ");
- if (!updates_disabled())
- if (!(p = getstarg(player->argp[2], "Disable update [y]? ", buf))
- || *p != 'n')
+ if (player->aborted)
+ return RET_SYN;
+ if (!updates_disabled()) {
+ p = getstarg(player->argp[2], "Disable update [y]? ", buf);
+ if (!p)
+ return RET_SYN;
+ if (*p != 'n')
disa();
+ }
shutdown_was_pending = shutdown_initiate(shutdown_minutes);
if (shutdown_was_pending < 0)
if (type == EF_LAND) {
sprintf(prompt, "Land unit(s) to tend from %s? ",
prship(&tender));
- if (!(p = getstarg(player->argp[3], prompt, buf)) || !*p)
+ p = getstarg(player->argp[3], prompt, buf);
+ if (!p)
+ return RET_SYN;
+ if (!*p)
continue;
if (!check_ship_ok(&tender))
return RET_SYN;
}
sprintf(prompt, "Number of %s to tend from %s? ",
ip->i_name, prship(&tender));
- if (!(p = getstarg(player->argp[3], prompt, buf)) || !*p)
+ p = getstarg(player->argp[3], prompt, buf);
+ if (!p)
+ return RET_SYN;
+ if (!*p)
continue;
if (!check_ship_ok(&tender))
return RET_SYN;
nships = carriersatxy(target->sct_x, target->sct_y, player->cnum);
if (nships) {
for (;;) {
- if (!(p = getstarg(0, "Carrier #? ", buf)) || !*p)
+ p = getstring("Carrier #? ", buf);
+ if (!p)
+ return -1;
+ if (!*p)
break;
cno = atoi(p);
if (cno < 0