]> git.pond.sub.org Git - empserver/commitdiff
(max_population): Deal gracefully with big city 10 * d_maxpop >
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 13 Jun 2006 17:46:04 +0000 (17:46 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 13 Jun 2006 17:46:04 +0000 (17:46 +0000)
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

index 038ec71783eea385c495591e9c4dfa2249a601ca..bef7ccbecf370ca34853a05fb174b23c62aaee68 100644 (file)
@@ -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 */