]> git.pond.sub.org Git - empserver/commitdiff
(fuel, load, prod, max_population, shp_nav_one_sector,
authorRon Koenderink <rkoenderink@yahoo.ca>
Mon, 14 Nov 2005 13:52:12 +0000 (13:52 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Mon, 14 Nov 2005 13:52:12 +0000 (13:52 +0000)
nav_loadship, upd_buildeff): Identify BIG_CITY
(IS_BIG_CITY) by using packing type of UPKG instead of
opt_BIG_CITY and sector type of SCT_CAPITAL.

include/sect.h
src/lib/commands/fuel.c
src/lib/commands/load.c
src/lib/commands/prod.c
src/lib/common/res_pop.c
src/lib/subs/shpsub.c
src/lib/update/nav_ship.c
src/lib/update/sect.c

index ae869f3d25e293e75b81ca3fc3791c5c668b4b2e..f0b576ea795dddcd69d0a996cfd443e0bab28ebd 100644 (file)
@@ -165,6 +165,7 @@ extern int sctoff(coord x, coord y);
 
 extern struct dchrstr dchr[SCT_MAXDEF + 1];
 extern struct dchrstr bigcity_dchr;
 
 extern struct dchrstr dchr[SCT_MAXDEF + 1];
 extern struct dchrstr bigcity_dchr;
+#define IS_BIG_CITY(sect) (dchr[sect].d_pkg == UPKG)
 
 /* Minimal efficiency of sectors that can be knocked down (bridges) */
 #define SCT_MINEFF 20
 
 /* Minimal efficiency of sectors that can be knocked down (bridges) */
 #define SCT_MINEFF 20
index f97456d8ff077710e23a82147b053b2ca48e6b0e..ffd1c9f402f6aa3aa5131c617da0b038ab6ae920 100644 (file)
@@ -121,9 +121,8 @@ fuel(void)
 
            if ((sect.sct_type != SCT_HARBR)
                && (sect.sct_type != SCT_WATER)
 
            if ((sect.sct_type != SCT_HARBR)
                && (sect.sct_type != SCT_WATER)
-               && (sect.sct_type != SCT_BSPAN) && (!opt_BIG_CITY
-                                                   || sect.sct_type !=
-                                                   SCT_CAPIT)) {
+               && (sect.sct_type != SCT_BSPAN)
+               && (!IS_BIG_CITY(sect.sct_type))) {
                pr("Sector %s is not a harbor, bridge span, or sea.\n",
                   xyas(item.ship.shp_x, item.ship.shp_y,
                        item.ship.shp_own));
                pr("Sector %s is not a harbor, bridge span, or sea.\n",
                   xyas(item.ship.shp_x, item.ship.shp_y,
                        item.ship.shp_own));
@@ -134,7 +133,7 @@ fuel(void)
 
            harbor = 0;
            if (sect.sct_type == SCT_HARBR
 
            harbor = 0;
            if (sect.sct_type == SCT_HARBR
-               || (opt_BIG_CITY && sect.sct_type == SCT_CAPIT)) {
+               || IS_BIG_CITY(sect.sct_type)) {
                harbor = 1;
                oil_amt = sect.sct_item[I_OIL];
                pet_amt = sect.sct_item[I_PETROL];
                harbor = 1;
                oil_amt = sect.sct_item[I_OIL];
                pet_amt = sect.sct_item[I_PETROL];
index fee70f9add4768b503914d6df2b920049fca2acc..6df3419129067884d303d931d14ddd8f476aecf3 100644 (file)
@@ -138,7 +138,7 @@ load(void)
            continue;
        if (!player->owner &&
            sect.sct_type != SCT_HARBR &&
            continue;
        if (!player->owner &&
            sect.sct_type != SCT_HARBR &&
-           (!opt_BIG_CITY || sect.sct_type != SCT_CAPIT))
+           !IS_BIG_CITY(sect.sct_type))
            continue;
        if (!sect.sct_own)
            continue;
            continue;
        if (!sect.sct_own)
            continue;
@@ -149,11 +149,13 @@ load(void)
            continue;
        }
        if (sect.sct_type != SCT_HARBR &&
            continue;
        }
        if (sect.sct_type != SCT_HARBR &&
-           (!opt_BIG_CITY || sect.sct_type != SCT_CAPIT)) {
+           !IS_BIG_CITY(sect.sct_type)) {
            if (noisy)
            if (noisy)
-               pr("Sector %s is not a harbor%s.\n",
+               pr("Sector %s is not a harbor%s%s.\n",
                   xyas(ship.shp_x, ship.shp_y, player->cnum),
                   xyas(ship.shp_x, ship.shp_y, player->cnum),
-                  opt_BIG_CITY ? " or a city" : "");
+                  IS_BIG_CITY(sect.sct_type) ? " or a " : "",
+                  IS_BIG_CITY(sect.sct_type) ?
+                   dchr[sect.sct_type].d_name : "");
            continue;
        }
        if (sect.sct_own != player->cnum && load_unload == UNLOAD
            continue;
        }
        if (sect.sct_own != player->cnum && load_unload == UNLOAD
index fd6cbb4f4fafb4aa3a2519a873af51a70240ea99..6101b17cc002674a540fa8f83d2a02c4cb2fe01c 100644 (file)
@@ -136,18 +136,16 @@ prod(void)
                type = sect.sct_newtype;
                eff = 0;
            }
                type = sect.sct_newtype;
                eff = 0;
            }
-           if (opt_BIG_CITY) {
-               if (!eff && dchr[otype].d_pkg == UPKG &&
-                   dchr[type].d_pkg != UPKG) {
-                   natp = getnatp(sect.sct_own);
-                   maxpop = max_population(natp->nat_level[NAT_RLEV],
-                                           type, eff);
-                   work = new_work(&sect,
-                                   total_work(sect.sct_work, etu_per_update,
-                                              civs, sect.sct_item[I_MILIT],
-                                              uws, maxpop));
-                   bwork = min(work / 2, bwork);
-               }
+           if (!eff && IS_BIG_CITY(otype) &&
+               !IS_BIG_CITY(type)) {
+               natp = getnatp(sect.sct_own);
+               maxpop = max_population(natp->nat_level[NAT_RLEV],
+                                       type, eff);
+               work = new_work(&sect,
+                               total_work(sect.sct_work, etu_per_update,
+                                          civs, sect.sct_item[I_MILIT],
+                                          uws, maxpop));
+               bwork = min(work / 2, bwork);
            }
            twork = 100 - eff;
            if (twork > bwork) {
            }
            twork = 100 - eff;
            if (twork > bwork) {
index 036040c12fcf797db899ab8826fbef2edd80e365..eba5b8b004b0c552a946e27397e50d254340edca 100644 (file)
@@ -46,11 +46,9 @@ max_population(float research, int desig, int eff)
     int maxpop = dchr[desig].d_maxpop;
     int rmax;
 
     int maxpop = dchr[desig].d_maxpop;
     int rmax;
 
-    if (opt_BIG_CITY) {
-       /* city efficiency limits maximum population */
-       if (dchr[desig].d_pkg == UPKG)
-           maxpop *= 1 + 9.0 * eff / 100;
-    }
+    /* city efficiency limits maximum population */
+    if (IS_BIG_CITY(desig))
+       maxpop *= 1 + 9.0 * eff / 100;
 
     if (opt_RES_POP) {
        /* research limits maximum population */
 
     if (opt_RES_POP) {
        /* research limits maximum population */
index 843780c9799116b61eec7a3edd31edceec66f11a..ccb72fd56e194d634127fc96f28a4e71ef4668bb 100644 (file)
@@ -834,7 +834,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
                continue;
            }
        }
                continue;
            }
        }
-       if (opt_BIG_CITY && sect.sct_type == SCT_CAPIT) {
+       if (IS_BIG_CITY(sect.sct_type)) {
            if (mlp->mcp->m_lcm + 2 * mlp->mcp->m_hcm >= 60) {
                sprintf(dp,
                        "is too large to fit into the canal system at %s",
            if (mlp->mcp->m_lcm + 2 * mlp->mcp->m_hcm >= 60) {
                sprintf(dp,
                        "is too large to fit into the canal system at %s",
index 5b0c7017d7b33166547f4024791440ac0fecc1ff..6353b00864f76c49443fff39c76d2ebd318c2fb4 100644 (file)
@@ -192,7 +192,7 @@ nav_loadship(struct shpstr *sp, natid cnum)
            continue;
        }
        if (sectp->sct_type != SCT_HARBR &&
            continue;
        }
        if (sectp->sct_type != SCT_HARBR &&
-           (!opt_BIG_CITY || sectp->sct_type != SCT_CAPIT)) {
+           !IS_BIG_CITY(sectp->sct_type)) {
            /* we can only load in harbors */
            didsomething[i] = 1;
            continue;
            /* we can only load in harbors */
            didsomething[i] = 1;
            continue;
index ad123c093544676eb4c5084219e8b95230dfacda..e8e5341503492e569f09f527a77140dbdc71582f 100644 (file)
@@ -84,20 +84,18 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp,
        }
        neweff = n;
        *cost += work_cost;
        }
        neweff = n;
        *cost += work_cost;
-       if (opt_BIG_CITY) {
-           if (!n && dchr[old_type].d_pkg == UPKG &&
-               dchr[*desig].d_pkg != UPKG) {
-               int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n);
-               if (vec[I_CIVIL] > maxpop)
-                   vec[I_CIVIL] = maxpop;
-               if (vec[I_UW] > maxpop)
-                   vec[I_UW] = maxpop;
-               *workp = (vec[I_CIVIL] * sctwork) / 100.0
-                   + (vec[I_MILIT] * 2 / 5.0) + vec[I_UW];
-               *workp = roundavg((etu * (*workp)) / 100.0);
-
-               buildeff_work = min((int)(*workp / 2), buildeff_work);
-           }
+       if (!n && IS_BIG_CITY(old_type) &&
+           !IS_BIG_CITY(*desig)) {
+           int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n);
+           if (vec[I_CIVIL] > maxpop)
+               vec[I_CIVIL] = maxpop;
+           if (vec[I_UW] > maxpop)
+               vec[I_UW] = maxpop;
+           *workp = (vec[I_CIVIL] * sctwork) / 100.0
+               + (vec[I_MILIT] * 2 / 5.0) + vec[I_UW];
+           *workp = roundavg((etu * (*workp)) / 100.0);
+
+           buildeff_work = min((int)(*workp / 2), buildeff_work);
        }
     }
     if (np->nat_priorities[*desig]) {
        }
     }
     if (np->nat_priorities[*desig]) {