From be430d4b9de69588c4bcbdf87fe12023129adb38 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 13 Jun 2006 17:46:04 +0000 Subject: [PATCH] (max_population): Deal gracefully with big city 10 * d_maxpop > ITEM_MAX: let value grow linearly from d_maxpop at 0% to the minimum of 10 * d_maxpop and ITEM_MAX at 100%. --- src/lib/common/res_pop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/common/res_pop.c b/src/lib/common/res_pop.c index 038ec717..bef7ccbe 100644 --- a/src/lib/common/res_pop.c +++ b/src/lib/common/res_pop.c @@ -46,11 +46,13 @@ int max_population(float research, int desig, int eff) { int maxpop = dchr[desig].d_maxpop; - int rmax; + int mp100, rmax; /* city efficiency limits maximum population */ - if (IS_BIG_CITY(desig)) - maxpop *= 1 + 9.0 * eff / 100; + if (IS_BIG_CITY(desig)) { + mp100 = MIN(ITEM_MAX, 10 * maxpop); + maxpop += (mp100 - maxpop) * eff / 100.0; + } if (opt_RES_POP) { /* research limits maximum population */