]> git.pond.sub.org Git - empserver/commitdiff
Make "build n" accept the optional tech argument
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Apr 2011 08:15:16 +0000 (10:15 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 29 May 2011 13:45:11 +0000 (15:45 +0200)
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

index 97dd42ddcc2bf57f5bd2bde16181dff83620d2ad..c700c047afe47d1fdf87186049ceca7ff7aaedd3 100644 (file)
@@ -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) {