From 8fa45735dba6a89e03c1c12039fa0a8b25496c56 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 20 Jul 2008 08:41:12 -0400 Subject: [PATCH] Make zdone accept country names Use natarg() so that country names work. Simplify control flow. --- src/lib/commands/zdon.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/lib/commands/zdon.c b/src/lib/commands/zdon.c index c439f8d8..346b8883 100644 --- a/src/lib/commands/zdon.c +++ b/src/lib/commands/zdon.c @@ -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))) {