From 8f6c4f18d7bde1fce1cdfa7b201734abd76a5a4d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 23 Apr 2011 08:26:36 +0200 Subject: [PATCH] Don't truncate research before multiplying with drnuke_const 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib/commands/buil.c b/src/lib/commands/buil.c index 456f28b5..e8f31bb6 100644 --- a/src/lib/commands/buil.c +++ b/src/lib/commands/buil.c @@ -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; }