]> git.pond.sub.org Git - empserver/commitdiff
From Ray Hyatt:
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 12 Feb 2005 16:17:57 +0000 (16:17 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 12 Feb 2005 16:17:57 +0000 (16:17 +0000)
(dchrstr): New member d_maxpop.
(dchr): Initialize it.
(max_pop): Use it.  Use dchr[SCT_MINE].d_maxpop when called with null
argument.  RES_POP now affects mountains and plains as well.

include/sect.h
src/lib/common/res_pop.c
src/lib/global/sect.c

index 7cd4fa1ee934abfa6e8f4ff833decc890bc2f692..143cdf08c0c1f7a6d6a7f627c64509dfb8380999 100644 (file)
@@ -100,6 +100,7 @@ struct dchrstr {
     int d_build;               /* cost multiplier for eff */
     int d_lcms;                        /* lcm's needed per point of eff */
     int d_hcms;                        /* hcm's needed per point of eff */
+    int d_maxpop;              /* maximum population */
     char *d_name;              /* full name of sector type */
 };
 
index ba1db6ac9b1fd7293c24caa4f7ea3a6ef7462892..5b3428f60f2173fb025997b694c0042c25304469 100644 (file)
 int
 max_pop(float research, struct sctstr *sp)
 {
-    int maxpop = 999;
+    int maxpop = dchr[sp ? sp->sct_type : SCT_MINE].d_maxpop;
 
     if (opt_RES_POP) {
-       maxpop = 400 + 600 * ((50.0 + 4.0 * research)
-                             / (200.0 + 3.0 * research));
+       /* 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;
     }
 
     if (opt_BIG_CITY) {
+       /* city efficiency limits maximum population */
        if (sp && dchr[sp->sct_type].d_pkg == UPKG)
            maxpop = (int)(maxpop * ((9.0 * sp->sct_effic) / 100 + 1));
+       if (CANT_HAPPEN(maxpop > 9999))
+           maxpop = 9999;
     }
-
-    if (sp) {
-       if (sp->sct_type == SCT_MOUNT)
-           maxpop /= 10;
-       else if (sp->sct_type == SCT_PLAINS)
-           maxpop /= 20;
-    }
-
     return maxpop;
 }
index 2f41631c0f54be0b934ffb79af2a36acaebc8f51..ce0068ddf2a60c1e4214c7433de4373bedd4824f 100644 (file)
 #include "product.h"
 
 struct dchrstr bigcity_dchr = {
-    'c', 0, 2, NAV_02, UPKG, 1.0, 2.0, 30, 0, 10, 1, 2, "city"
+    'c', 0, 2, NAV_02, UPKG, 1.0, 2.0, 30, 0, 10, 1, 2, 9999, "city"
 };
 
 struct dchrstr dchr[SCT_MAXDEF + 2] = {
 /*
-  mnem prd     mcst  flg    pkg ostr dstr value $ bld lcm hcm   name    */
-    {'.', 0, 0, NAVOK, NPKG, 0.0, 0.0, 0, -1, 0, 0, 0, "sea"},
-    {'^', P_MDUST, 25, 0, NPKG, 1.0, 4.0, 5, -1, 1, 0, 0, "mountain"},
-    {'s', 0, 0, 0, NPKG, 0.0, 99.0, 127, -1, 0, 0, 0, "sanctuary"},
-    {'\\', 0, 0, 0, NPKG, 0.0, 99.0, 0, -1, 0, 0, 0, "wasteland"},
-    {'-', 0, 3, 0, NPKG, 1.0, 2.0, 1, 0, 0, 0, 0, "wilderness"},
-    {'c', 0, 2, 0, NPKG, 1.0, 2.0, 30, 0, 1, 0, 0, "capital"},
-    {'u', P_URAN, 2, 0, NPKG, 1.0, 2.0, 15, 0, 1, 0, 0, "uranium mine"},
-    {'p', P_HLEV, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, "park"},
-    {'d', P_GUN, 2, 0, NPKG, 1.0, 1.5, 7, 0, 1, 0, 0, "defense plant"},
-    {'i', P_SHELL, 2, 0, NPKG, 1.0, 1.5, 6, 0, 1, 0, 0, "shell industry"},
-    {'m', P_IRON, 2, 0, NPKG, 1.0, 2.0, 5, 0, 1, 0, 0, "mine"},
-    {'g', P_DUST, 2, 0, NPKG, 1.0, 2.0, 8, 0, 1, 0, 0, "gold mine"},
-    {'h', 0, 2, NAV_02, WPKG, 1.0, 1.5, 12, 0, 1, 0, 0, "harbor"},
-    {'w', 0, 2, 0, WPKG, 1.0, 1.5, 7, 0, 1, 0, 0, "warehouse"},
-    {'*', 0, 2, 0, NPKG, 1.0, 1.25, 12, 0, 1, 0, 0, "airfield"},
-    {'a', P_FOOD, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, "agribusiness"},
-    {'o', P_OIL, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, "oil field"},
-    {'j', P_LCM, 2, 0, NPKG, 1.0, 1.5, 3, 0, 1, 0, 0, "light manufacturing"},
-    {'k', P_HCM, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "heavy manufacturing"},
-    {'f', 0, 2, 0, NPKG, 2.0, 4.0, 10, 0, 5, 0, 1, "fortress"},
-    {'t', P_TLEV, 2, 0, NPKG, 1.0, 1.5, 10, 0, 1, 0, 0, "technical center"},
-    {'r', P_RLEV, 2, 0, NPKG, 1.0, 1.5, 9, 0, 1, 0, 0, "research lab"},
-    {'n', 0, 2, 0, NPKG, 1.0, 2.0, 10, 0, 1, 0, 0, "nuclear plant"},
-    {'l', P_ELEV, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "library/school"},
-    {'+', 0, 1, 0, NPKG, 1.0, 1.0, 3, 0, 1, 0, 0, "highway"},
-    {')', 0, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "radar installation"},
-    {'!', 0, 2, 0, NPKG, 1.0, 1.5, 12, 0, 1, 0, 0, "headquarters"},
-    {'#', 0, 1, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, "bridge head"},
-    {'=', 0, 1, NAV_60, NPKG, 1.0, 1.0, 5, -1, 1, 0, 0, "bridge span"},
-    {'b', P_BAR, 2, 0, BPKG, 1.0, 2.25, 10, 0, 1, 0, 0, "bank"},
-    {'%', P_PETROL, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, "refinery"},
-    {'e', 0, 2, 0, NPKG, 1.0, 2.0, 7, 0, 1, 0, 0, "enlistment center"},
-    {'~', 0, 2, 0, NPKG, 1.0, 1.5, 1, -1, 1, 0, 0, "plains"},
-    {'@', 0, 1, 0, NPKG, 1.0, 1.5, 4, -1, 1, 0, 0, "bridge tower"},
-    {0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0},
-    {0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0}
+  mnem prd     mcst  flg    pkg ostr dstr value $ bld lcm hcm maxpop  name    */
+    {'.', 0, 0, NAVOK, NPKG, 0.0, 0.0, 0, -1, 0, 0, 0, 0, "sea"},
+    {'^', P_MDUST, 25, 0, NPKG, 1.0, 4.0, 5, -1, 1, 0, 0, 99, "mountain"},
+    {'s', 0, 0, 0, NPKG, 0.0, 99.0, 127, -1, 0, 0, 0, 9999, "sanctuary"},
+    {'\\', 0, 0, 0, NPKG, 0.0, 99.0, 0, -1, 0, 0, 0, 0, "wasteland"},
+    {'-', 0, 3, 0, NPKG, 1.0, 2.0, 1, 0, 0, 0, 0, 999, "wilderness"},
+    {'c', 0, 2, 0, NPKG, 1.0, 2.0, 30, 0, 1, 0, 0, 999, "capital"},
+    {'u', P_URAN, 2, 0, NPKG, 1.0, 2.0, 15, 0, 1, 0, 0, 999, "uranium mine"},
+    {'p', P_HLEV, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, 999, "park"},
+    {'d', P_GUN, 2, 0, NPKG, 1.0, 1.5, 7, 0, 1, 0, 0, 999, "defense plant"},
+    {'i', P_SHELL, 2, 0, NPKG, 1.0, 1.5, 6, 0, 1, 0, 0, 999, "shell industry"},
+    {'m', P_IRON, 2, 0, NPKG, 1.0, 2.0, 5, 0, 1, 0, 0, 999, "mine"},
+    {'g', P_DUST, 2, 0, NPKG, 1.0, 2.0, 8, 0, 1, 0, 0, 999, "gold mine"},
+    {'h', 0, 2, NAV_02, WPKG, 1.0, 1.5, 12, 0, 1, 0, 0, 999, "harbor"},
+    {'w', 0, 2, 0, WPKG, 1.0, 1.5, 7, 0, 1, 0, 0, 999, "warehouse"},
+    {'*', 0, 2, 0, NPKG, 1.0, 1.25, 12, 0, 1, 0, 0, 999, "airfield"},
+    {'a', P_FOOD, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, 999, "agribusiness"},
+    {'o', P_OIL, 2, 0, NPKG, 1.0, 1.5, 5, 0, 1, 0, 0, 999, "oil field"},
+    {'j', P_LCM, 2, 0, NPKG, 1.0, 1.5, 3, 0, 1, 0, 0, 999, "light manufacturing"},
+    {'k', P_HCM, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "heavy manufacturing"},
+    {'f', 0, 2, 0, NPKG, 2.0, 4.0, 10, 0, 5, 0, 1, 999, "fortress"},
+    {'t', P_TLEV, 2, 0, NPKG, 1.0, 1.5, 10, 0, 1, 0, 0, 999, "technical center"},
+    {'r', P_RLEV, 2, 0, NPKG, 1.0, 1.5, 9, 0, 1, 0, 0, 999, "research lab"},
+    {'n', 0, 2, 0, NPKG, 1.0, 2.0, 10, 0, 1, 0, 0, 999, "nuclear plant"},
+    {'l', P_ELEV, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "library/school"},
+    {'+', 0, 1, 0, NPKG, 1.0, 1.0, 3, 0, 1, 0, 0, 999, "highway"},
+    {')', 0, 2, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "radar installation"},
+    {'!', 0, 2, 0, NPKG, 1.0, 1.5, 12, 0, 1, 0, 0, 999, "headquarters"},
+    {'#', 0, 1, 0, NPKG, 1.0, 1.5, 4, 0, 1, 0, 0, 999, "bridge head"},
+    {'=', 0, 1, NAV_60, NPKG, 1.0, 1.0, 5, -1, 1, 0, 0, 999, "bridge span"},
+    {'b', P_BAR, 2, 0, BPKG, 1.0, 2.25, 10, 0, 1, 0, 0, 999, "bank"},
+    {'%', P_PETROL, 2, 0, NPKG, 1.0, 1.5, 2, 0, 1, 0, 0, 999, "refinery"},
+    {'e', 0, 2, 0, NPKG, 1.0, 2.0, 7, 0, 1, 0, 0, 999, "enlistment center"},
+    {'~', 0, 2, 0, NPKG, 1.0, 1.5, 1, -1, 1, 0, 0, 50, "plains"},
+    {'@', 0, 1, 0, NPKG, 1.0, 1.5, 4, -1, 1, 0, 0, 999, "bridge tower"},
+    {0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0, NULL},
+    {0, 0, 0, 0, IPKG, 0, 0, 0, 0, 0, 0, 0, 0, NULL}
 };
 
 struct sctintrins intrchr[] = {