From d5d8028ad1e4713a488befb9182aa28852039120 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 17 Feb 2005 21:40:24 +0000 Subject: [PATCH] (max_population): Fix for opt_RES_POP and d_maxpop != 999. --- src/lib/common/res_pop.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/lib/common/res_pop.c b/src/lib/common/res_pop.c index 298c8ea6..63cf21c0 100644 --- a/src/lib/common/res_pop.c +++ b/src/lib/common/res_pop.c @@ -44,23 +44,25 @@ int max_population(float research, int desig, int eff) { int maxpop = dchr[desig].d_maxpop; - - if (opt_RES_POP) { - /* research limits maximum population */ - maxpop = maxpop * 0.4 - + maxpop * 0.6 * (50.0 + 4.0*research) / (200.0 + 3.0*research); - if (maxpop > 999) - maxpop = 999; - } + int rmax; if (opt_BIG_CITY) { /* city efficiency limits maximum population */ if (dchr[desig].d_pkg == UPKG) maxpop *= 1 + 9.0 * eff / 100; - if (CANT_HAPPEN(maxpop > 9999)) - maxpop = 9999; } + if (opt_RES_POP) { + /* research limits maximum population */ + rmax = maxpop * 0.4 + + maxpop * 0.6 * (50.0 + 4.0*research) / (200.0 + 3.0*research); + if (maxpop > rmax) + maxpop = rmax; + } + + if (CANT_HAPPEN(maxpop > ITEM_MAX)) + maxpop = ITEM_MAX; + return maxpop; }