]> git.pond.sub.org Git - empserver/commitdiff
Clean up how desi() handles bad designation arguments
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 20 Jul 2008 21:12:51 +0000 (17:12 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 21 Jul 2008 12:13:40 +0000 (08:13 -0400)
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.

src/lib/commands/desi.c

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