From c6137c7ba2f65372c3eccac88be8a385fc2b9e7c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 23 Apr 2011 10:15:16 +0200 Subject: [PATCH] Make "build n" accept the optional tech argument It has currently no real effect on the nuke built (nukes don't improve with tech), but the special case is ugly, and is inconsistent with info build. --- src/lib/commands/buil.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib/commands/buil.c b/src/lib/commands/buil.c index 97dd42dd..c700c047 100644 --- a/src/lib/commands/buil.c +++ b/src/lib/commands/buil.c @@ -72,7 +72,7 @@ buil(void) char *p, *what, *prompt; int gotsect = 0; int (*build_it)(struct sctstr *, int, short[], int); - int number; + int number, val; char buf[1024]; natp = getnatp(player->cnum); @@ -180,20 +180,20 @@ buil(void) } } - if (*what != 'n') { - if (player->argp[5]) { - tlev = atoi(player->argp[5]); - if (tlev > natp->nat_level[NAT_TLEV] && !player->god) { - pr("Your tech level is only %d.\n", - (int)natp->nat_level[NAT_TLEV]); - return RET_FAIL; - } - if (rqtech > tlev) { - pr("Required tech is %d.\n", rqtech); - return RET_FAIL; - } - pr("building with tech level %d.\n", tlev); + if (player->argp[5]) { + val = atoi(player->argp[5]); + if (val > tlev && !player->god) { + pr("Your%s tech level is only %d.\n", + *what == 'n' && drnuke_const > MIN_DRNUKE_CONST + ? " effective" : "", tlev); + return RET_FAIL; } + if (rqtech > val) { + pr("Required tech is %d.\n", rqtech); + return RET_FAIL; + } + tlev = val; + pr("Building with tech level %d.\n", tlev); } while (number-- > 0) {