Clean up how desi() handles bad designation arguments

Fail the command when the designation isn't allowed for mortals, or
when the player can't afford it.

Treat '=' and '@' like the other designations not allowed for mortals,
not like invalid designations.  Change failure for invalid designation
from RET_FAIL to RET_SYN.
This commit is contained in:
Markus Armbruster 2008-07-20 17:12:51 -04:00
parent d000bf9296
commit a7cf69af50

View file

@ -75,22 +75,24 @@ desi(void)
continue; continue;
des = sct_typematch(p); des = sct_typematch(p);
if (des < 0 || (((des == SCT_BSPAN) || (des == SCT_BTOWER)) && if (des < 0) {
!player->god)) {
pr("No such designation\n" pr("No such designation\n"
"See \"info Sector-types\" for possible designations\n"); "See \"info Sector-types\" for possible designations\n");
rc = RET_FAIL; rc = RET_SYN;
break; break;
} }
if (!player->god) { if (!player->god) {
if (des == SCT_WASTE) { if (des == SCT_WASTE) {
pr("Only a nuclear device (or %s) can make a %s!\n", pr("Only a nuclear device (or %s) can make a %s!\n",
cname(0), dchr[des].d_name); cname(0), dchr[des].d_name);
continue; rc = RET_FAIL;
break;
} }
if (dchr[des].d_cost < 0) { if (dchr[des].d_cost < 0) {
pr("Only %s can make a %s!\n", cname(0), dchr[des].d_name); pr("Only %s can designate a %s!\n",
continue; cname(0), dchr[des].d_name);
rc = RET_FAIL;
break;
} }
} }
if (sect.sct_type == des && sect.sct_newtype == des) if (sect.sct_type == des && sect.sct_newtype == des)
@ -110,6 +112,7 @@ desi(void)
&& dchr[des].d_cost > 0) { && dchr[des].d_cost > 0) {
if (natp->nat_money < player->dolcost + dchr[des].d_cost) { if (natp->nat_money < player->dolcost + dchr[des].d_cost) {
pr("You can't afford a %s!\n", dchr[des].d_name); pr("You can't afford a %s!\n", dchr[des].d_name);
rc = RET_FAIL;
break; break;
} }
player->dolcost += dchr[des].d_cost; player->dolcost += dchr[des].d_cost;