Make zdone accept country names

Use natarg() so that country names work.  Simplify control flow.
This commit is contained in:
Markus Armbruster 2008-07-20 08:41:12 -04:00
parent 9031b03b56
commit 8fa45735db

View file

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