]> git.pond.sub.org Git - empserver/commitdiff
(acce, flash, nati, new, rela): Don't bother to complain about bad
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 6 Jan 2006 17:44:31 +0000 (17:44 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 6 Jan 2006 17:44:31 +0000 (17:44 +0000)
country argument, natarg() does that.

(acce, flash, nati, rela): natarg() ensures getnatp() succeeds, no
need to check.

src/lib/commands/acce.c
src/lib/commands/flash.c
src/lib/commands/nati.c
src/lib/commands/new.c
src/lib/commands/rela.c

index 5b7df766e57636ab5f870d477f3ea6e94040b47a..1d750953f500977d9102a9d6d8a5c5baeead9ec7 100644 (file)
@@ -58,16 +58,11 @@ acce(void)
     if (player->argp[1] == 0)
        as = player->cnum;
     else {
-       if ((n = natarg(player->argp[1], "Which country? ")) < 0) {
-           pr("Bad country number\n");
+       if ((n = natarg(player->argp[1], "Which country? ")) < 0)
            return RET_SYN;
-       }
        as = (natid)n;
     }
-    if ((natp = getnatp(as)) == 0) {
-       pr("Bad country number %d\n", player->cnum);
-       return RET_SYN;
-    }
+    natp = getnatp(as);
     pr("\t%s Acceptance Status Report\t", cname(as));
     prdate();
     pr("\n  Acceptance status          %5s                theirs\n",
index 8f00361501d826f9474ad0a83057a5fbcedb4816..6cf9b6c11eb246275e61e339f2d959c4fc3debe7 100644 (file)
@@ -53,10 +53,7 @@ flash(void)
     us = getnatp(player->cnum);
     if ((tocn = natarg(player->argp[1], "to which country? ")) < 0)
        return RET_SYN;
-    if (!(to = getnatp((natid)tocn))) {
-       pr("Bad country number\n");
-       return RET_SYN;
-    }
+    to = getnatp(tocn);
 
     if (us->nat_stat == STAT_GOD) {
        /* We are gods, we can flash anyone */
index 200fcaf82f8b2539028be1906bf1a996e3bc373e..bbb84ba78036715625f3000882c81fde228ca83e 100644 (file)
@@ -59,10 +59,8 @@ nati(void)
     else
        cnum = player->cnum;
 
-    if ((natp = getnatp(cnum)) == 0) {
-       pr("Bad country number %d\n", cnum);
+    if ((natp = getnatp(cnum)) == 0)
        return RET_SYN;
-    }
 
     if (!player->god && cnum != player->cnum) {
        pr("Only deities can request a nation "
index eb1098f1dd16cf90c2f7349087596d82e1168d0e..9b1f0e13e0bc839e5f084bca3cb20c5290d6a526 100644 (file)
@@ -72,12 +72,10 @@ new(void)
     natp = getnatp(player->cnum);
     if (natp->nat_xorg != 0 || natp->nat_yorg != 0) {
        pr("Must be at 0,0 to add a new country\n");
-       return 0;
-    }
-    if ((n = natarg(player->argp[1], "Country? ")) < 0) {
-       pr("Bad country number\n");
-       return 0;
+       return RET_FAIL;
     }
+    if ((n = natarg(player->argp[1], "Country? ")) < 0)
+       return RET_SYN;
     num = n;
     natp = getnatp(num);
     if (natp->nat_stat != STAT_NEW) {
index fd35af58ac17210f7e4307960f0b97ccce7a0cfc..f6f65c94fba9554c0fccc2f33fb62215762137fa 100644 (file)
@@ -58,16 +58,11 @@ rela(void)
     if (player->argp[1] == 0)
        as = player->cnum;
     else {
-       if ((n = natarg(player->argp[1], "Which country? ")) < 0) {
-           pr("Bad country number\n");
+       if ((n = natarg(player->argp[1], "Which country? ")) < 0)
            return RET_SYN;
-       }
        as = (natid)n;
     }
-    if ((natp = getnatp(as)) == 0) {
-       pr("Bad country number %d\n", player->cnum);
-       return RET_SYN;
-    }
+    natp = getnatp(as);
     pr("\t%s Diplomatic Relations Report\t", cname(as));
     prdate();
     pr("\n  Formal Relations         %5s      theirs\n",