Failing a command with code RET_SYN prints help and doesn't charge
BTUs. Failing with code RET_FAIL doesn't print help and charges BTUs.
A couple of command failures were changed or added recently to fail
with RET_SYN, because they're due to invalid player input. Some of
them, however, can happen after the command already did something, so
BTUs must be charged, or else players can deliberately fail the
command to save BTUs:
* Commit
9eda5f87 adds RET_SYN failures when getting player input
fails for:
- arm third argument
- deliver fourth argument
- fire third argument
- lmine second argument
- order d fourth argument
- range second argument
- sail second argument
- tend third argument
* Commit
be41e70f likewise for:
- designate second argument
- morale second argument
- set third argument
- tend fourth argument
* Commit
d000bf92 likewise (with a bogus commit message) for bdes
second argument.
* Commit
9f4ce71a likewise for ltend third and fourth argument.
* Commit
9031b03b changes failure code from RET_FAIL when getting
player input fails for threshold third argument. It adds RET_SYN
failure when the argument is bad. Some bad arguments already failed
that way before.
* Commit
a7cf69af changes it from RET_FAIL when designate second
argument is bad.
Change them all to fail with RET_FAIL.
Many other places have the same bug, but those are left for another
day.
}
p = getstarg(player->argp[3], "Airburst [n]? ", buf);
if (!p)
- return RET_SYN;
+ return RET_FAIL;
if (!check_plane_ok(&pl) || !check_nuke_ok(&nuke))
return RET_FAIL;
xyas(nstr.x, nstr.y, player->cnum),
d ? d : ' ');
if ((p = getstarg(player->argp[2], prompt, buf)) == 0) {
- rc = RET_SYN;
+ rc = RET_FAIL;
break;
}
if (!isprint(*p)) {
dchr[sect.sct_type].d_name, ich->i_name);
p = getstarg(player->argp[4], prompt, buf);
if (!p)
- return RET_SYN;
+ return RET_FAIL;
}
}
if (p && *p) {
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) {
- rc = RET_SYN;
+ rc = RET_FAIL;
break;
}
if (des < 0) {
pr("No such designation\n"
"See \"info Sector-types\" for possible designations\n");
- rc = RET_SYN;
+ rc = RET_FAIL;
break;
}
if (!player->god) {
continue;
if ((p =
getstarg(player->argp[3], "Amount to transfer? ", buf)) == 0)
- return RET_SYN;
+ return RET_FAIL;
if (!check_ship_ok(&tender))
return RET_FAIL;
if ((amt = atoi(p)) == 0)
}
if (!snxtitem(&targets, EF_LAND,
player->argp[4], "Units to be tended? "))
- return RET_SYN;
+ return RET_FAIL;
if (!check_ship_ok(&tender))
return RET_FAIL;
total = 0;
ptr = getstarg(player->argp[3], "Firing at? ", buf);
if (!ptr)
- return RET_SYN;
+ return RET_FAIL;
if (!*ptr)
continue;
if (!issector(ptr)) {
sprintf(prompt, "Drop how many mines from %s? ", prland(&land));
mines_wanted = onearg(player->argp[2], prompt);
if (mines_wanted < 0)
- return RET_SYN;
+ return RET_FAIL;
if (mines_wanted == 0)
continue;
if (!check_land_ok(&land))
prland(&land), min);
p = getstarg(player->argp[2], mess, buf);
if (!p)
- return RET_SYN;
+ return RET_FAIL;
if (!check_land_ok(&land))
continue;
if ((i = atoi(p)) < 0)
if (!orders) {
p = getstarg(player->argp[4], "Second dest? ", buf);
if (!p)
- return RET_SYN;
+ return RET_FAIL;
if (!*p || !strcmp(p, "-")) {
orders = 1;
pr("A one-way order has been accepted.\n");
continue;
p = getstarg(player->argp[2], "New range? ", buf);
if (!p)
- return RET_SYN;
+ return RET_FAIL;
if (!check_plane_ok(&plane))
return RET_SYN;
if ((i = atoi(p)) < 0)
cp = getpath(navpath, player->argp[2],
ship.shp_x, ship.shp_y, 0, 0, P_SAILING);
if (!cp)
- return RET_SYN;
+ return RET_FAIL;
if (!check_ship_ok(&ship))
continue;
strncpy(ship.shp_path, cp, sizeof(ship.shp_path) - 2);
sprintf(prompt, "%s #%d; Price? ",
trade_nameof(&trade, &item), ni.cur);
if ((p = getstarg(player->argp[3], prompt, buf)) == 0)
- return RET_SYN;
+ return RET_FAIL;
if (!trade_check_item_ok(&item))
return RET_FAIL;
if ((price = atoi(p)) < 0)
prship(&tender));
p = getstarg(player->argp[3], prompt, buf);
if (!p)
- return RET_SYN;
+ return RET_FAIL;
if (!*p)
continue;
if (!check_ship_ok(&tender))
ip->i_name, prship(&tender));
p = getstarg(player->argp[3], prompt, buf);
if (!p)
- return RET_SYN;
+ return RET_FAIL;
if (!*p)
continue;
if (!check_ship_ok(&tender))
}
if (!snxtitem(&targets, EF_SHIP,
player->argp[4], "Ships to be tended? "))
- return RET_SYN;
+ return RET_FAIL;
if (!check_ship_ok(&tender))
return RET_SYN;
total = 0;
}
if (!snxtitem(&targets, EF_SHIP,
player->argp[4], "Ship to be tended? "))
- return RET_SYN;
+ return RET_FAIL;
if (!check_land_ok(&land))
return RET_SYN;
while (nxtitem(&targets, &target)) {
xyas(nstr.x, nstr.y, player->cnum),
dchr[sect.sct_type].d_name);
if ((p = getstarg(player->argp[3], prompt, buf)) == 0)
- return RET_SYN;
+ return RET_FAIL;
if (!*p)
continue;
if (!check_sect_ok(§))
return RET_FAIL;
thresh = atoi(p);
if (thresh < 0)
- return RET_SYN;
+ return RET_FAIL;
if (thresh > ITEM_MAX)
thresh = ITEM_MAX;
if ((val > 0) && (val == thresh)) {