Fail commands properly when they get aborted
The old code didn't return RET_SYN when aborting at the following prompts: * designate second argument * morale second argument * route second argument * set third argument * tend fourth argument * zdone last argument
This commit is contained in:
parent
a7cf69af50
commit
be41e70fa8
6 changed files with 14 additions and 12 deletions
|
@ -60,7 +60,7 @@ desi(void)
|
|||
natp = getnatp(player->cnum);
|
||||
cap_x = natp->nat_xcap;
|
||||
cap_y = natp->nat_ycap;
|
||||
while (!player->aborted && nxtsct(&nstr, §)) {
|
||||
while (nxtsct(&nstr, §)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
if (!player->god && dchr[sect.sct_type].d_cost < 0)
|
||||
|
@ -68,8 +68,10 @@ desi(void)
|
|||
sprintf(prompt, "%s %d%% %s desig? ",
|
||||
xyas(sect.sct_x, sect.sct_y, player->cnum),
|
||||
sect.sct_effic, dchr[sect.sct_type].d_name);
|
||||
if ((p = getstarg(player->argp[2], prompt, buf)) == 0)
|
||||
continue;
|
||||
if ((p = getstarg(player->argp[2], prompt, buf)) == 0) {
|
||||
rc = RET_SYN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!check_sect_ok(§))
|
||||
continue;
|
||||
|
|
|
@ -50,7 +50,7 @@ morale(void)
|
|||
|
||||
if (!snxtitem(&np, EF_LAND, player->argp[1]))
|
||||
return RET_SYN;
|
||||
while (!player->aborted && nxtitem(&np, &land)) {
|
||||
while (nxtitem(&np, &land)) {
|
||||
if (!player->owner || land.lnd_own == 0)
|
||||
continue;
|
||||
natp = getnatp(land.lnd_own);
|
||||
|
@ -58,11 +58,11 @@ morale(void)
|
|||
sprintf(mess, "New retreat percentage for %s (min %d%%)? ",
|
||||
prland(&land), min);
|
||||
p = getstarg(player->argp[2], mess, buf);
|
||||
if (!p)
|
||||
return RET_SYN;
|
||||
if (!check_land_ok(&land))
|
||||
continue;
|
||||
if (player->aborted)
|
||||
continue;
|
||||
if (!p || (i = atoi(p)) < 0)
|
||||
if ((i = atoi(p)) < 0)
|
||||
continue;
|
||||
land.lnd_retreat = ((i < min) ? min : i);
|
||||
if (land.lnd_retreat > 100)
|
||||
|
|
|
@ -66,7 +66,7 @@ rout(void)
|
|||
return RET_SYN;
|
||||
i_del = ip->i_uid;;
|
||||
if (!snxtsct(&ns, player->argp[2]))
|
||||
return RET_FAIL;
|
||||
return RET_SYN;
|
||||
if (!mapbuf)
|
||||
mapbuf = malloc(WORLD_Y * MAPWIDTH(3));
|
||||
if (!map) {
|
||||
|
|
|
@ -93,7 +93,7 @@ set(void)
|
|||
sprintf(prompt, "%s #%d; Price? ",
|
||||
trade_nameof(&trade, &item), ni.cur);
|
||||
if ((p = getstarg(player->argp[3], prompt, buf)) == 0)
|
||||
break;
|
||||
return RET_SYN;
|
||||
if (!trade_check_item_ok(&item))
|
||||
return RET_FAIL;
|
||||
if ((price = atoi(p)) < 0)
|
||||
|
|
|
@ -129,7 +129,7 @@ tend(void)
|
|||
if (!snxtitem(&targets, EF_SHIP,
|
||||
getstarg(player->argp[4], "Ships to be tended? ",
|
||||
buf)))
|
||||
break;
|
||||
return RET_SYN;
|
||||
if (!check_ship_ok(&tender))
|
||||
return RET_SYN;
|
||||
total = 0;
|
||||
|
@ -231,7 +231,7 @@ tend_land(struct shpstr *tenderp, char *units)
|
|||
if (!snxtitem(&targets, EF_SHIP,
|
||||
getstarg(player->argp[4], "Ship to be tended? ",
|
||||
buf)))
|
||||
break;
|
||||
return RET_SYN;
|
||||
if (!check_land_ok(&land))
|
||||
return RET_SYN;
|
||||
while (nxtitem(&targets, &target)) {
|
||||
|
|
|
@ -87,7 +87,7 @@ zdon(void)
|
|||
p = getstarg(player->argp[1], "Want update? [Yes|No|Check] ", buf);
|
||||
}
|
||||
if (player->aborted)
|
||||
return RET_FAIL;
|
||||
return RET_SYN;
|
||||
|
||||
checking = 1;
|
||||
wantupd = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue