]> git.pond.sub.org Git - empserver/commitdiff
Make zdone accept country names
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 20 Jul 2008 12:41:12 +0000 (08:41 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 25 Jul 2008 12:16:38 +0000 (08:16 -0400)
Use natarg() so that country names work.  Simplify control flow.

src/lib/commands/zdon.c

index c439f8d8e2c48d697e00618c5defc1c5bed9cfcf..346b888334c84d89fcd7805d4e64d0c73a2a086a 100644 (file)
@@ -75,30 +75,28 @@ zdon(void)
        pr("Demand updates are not enabled.\n");
        return RET_FAIL;
     }
-    whichcnum = player->cnum;
-    p = NULL;
     if (player->god) {
        /* Deity syntax "country what" */
-       whichcnum = onearg(player->argp[1], "Which country no.? ");
-       if ((whichcnum > 0) && (getnatp(whichcnum)))
-           p = getstarg(player->argp[2], "Want update? [Yes|No|Check] ",
-                        buf);
+       whichcnum = natarg(player->argp[1], "Which country no.? ");
+       if (whichcnum < 0)
+           return RET_SYN;
+       p = getstarg(player->argp[2], "Want update? [Yes|No|Check] ", buf);
     } else {
+       whichcnum = player->cnum;
        p = getstarg(player->argp[1], "Want update? [Yes|No|Check] ", buf);
     }
-    if (player->aborted)
+    if (!p)
        return RET_SYN;
 
-    checking = 1;
-    wantupd = 0;
-    if (p) {
-       if (*p == 'y' || *p == 'Y') {
-           checking = 0;
-           wantupd = 1;
-       } else if  (*p == 'n' || *p == 'N') {
-           checking = 0;
-           wantupd = 0;
-       }
+    if (*p == 'y' || *p == 'Y') {
+       checking = 0;
+       wantupd = 1;
+    } else if  (*p == 'n' || *p == 'N') {
+       checking = 0;
+       wantupd = 0;
+    } else {
+       checking = 1;
+       wantupd = 0;
     }
 
     if (!(natp = getnatp(whichcnum))) {