]> git.pond.sub.org Git - empserver/commitdiff
Don't truncate research before multiplying with drnuke_const
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Apr 2011 06:26:36 +0000 (08:26 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Apr 2011 16:11:42 +0000 (18:11 +0200)
For drnuke_const 0.33, research level 92.4 now suffices for a tech 280
nuke.  Before, you needed 93, which was inconsistent with what
version's promise "need 0.33 times the tech level in research".

src/lib/commands/buil.c

index 456f28b57015d4e3e23200bf4af7be1a8b8170cf..e8f31bb60a8afa1178b81105ddb21844c98e42e9 100644 (file)
@@ -72,7 +72,6 @@ buil(void)
     struct natstr *natp;
     int rqtech;
     int tlev;
-    int rlev;
     int type;
     char what;
     struct lchrstr *lp;
@@ -86,6 +85,8 @@ buil(void)
     char buf[1024];
 
     natp = getnatp(player->cnum);
+    tlev = (int)natp->nat_level[NAT_TLEV];
+
     p = getstarg(player->argp[1],
                 "Build (ship, nuke, bridge, plane, land unit, tower)? ",
                 buf);
@@ -105,6 +106,9 @@ buil(void)
            pr("There are no nukes in this game.\n");
            return RET_FAIL;
        }
+       if (drnuke_const > MIN_DRNUKE_CONST)
+           tlev = MIN(tlev,
+                      (int)(natp->nat_level[NAT_RLEV] / drnuke_const));
        break;
     default:
        pr("You can't build that!\n");
@@ -113,8 +117,6 @@ buil(void)
 
     if (!snxtsct(&nstr, player->argp[2]))
        return RET_SYN;
-    tlev = (int)natp->nat_level[NAT_TLEV];
-    rlev = (int)natp->nat_level[NAT_RLEV];
 
     switch (what) {
     case 'p':
@@ -183,9 +185,6 @@ buil(void)
        if (type >= 0) {
            np = &nchr[type];
            rqtech = np->n_tech;
-           if (drnuke_const > MIN_DRNUKE_CONST)
-               tlev = (tlev < (rlev / drnuke_const) ? (int)tlev :
-                       (int)(rlev / drnuke_const));
            if (rqtech > tlev)
                type = -1;
        }