]> git.pond.sub.org Git - empserver/commitdiff
(upd_ship, upd_land): Simplify. No functional changes.
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 11 Mar 2004 13:31:28 +0000 (13:31 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 11 Mar 2004 13:31:28 +0000 (13:31 +0000)
src/lib/update/land.c
src/lib/update/ship.c

index 0a2f6f6b2f7fbb68b3779e8240b3bb051ba8281c..4aad1a3720608ae1fc06054e7f05d46be8558d84 100644 (file)
@@ -147,8 +147,8 @@ upd_land(register struct lndstr *lp, register int etus,
            mult *= 3;
 /*             cost = -(mult * etus * dmin(0.0, money_land * LND_COST(lcp->l_cost, lp->lnd_tech - lcp->l_tech)));*/
        cost = -(mult * etus * dmin(0.0, money_land * lcp->l_cost));
-       if ((np->nat_priorities[PRI_LMAINT] == 0 ||
-            np->nat_money < cost) && !player->simulation) {
+       if ((np->nat_priorities[PRI_LMAINT] == 0 || np->nat_money < cost)
+           && !player->simulation) {
            if ((eff = lp->lnd_effic - etus / 5) < LAND_MINEFF) {
                wu(0, lp->lnd_own,
                   "%s lost to lack of maintenance\n", prland(lp));
@@ -164,15 +164,13 @@ upd_land(register struct lndstr *lp, register int etus,
        } else {
            np->nat_money -= cost;
        }
-/* Mil costs are now part of regular mil costs, not maint costs */
-/*             np->nat_money += (int) (money_mil * etus * lnd_getmil(lp));*/
 
        /* Grab more stuff */
        if ((opt_NOFOOD == 0) && !player->simulation)
            resupply_commod(lp, I_FOOD);
 
-       getvec(VT_ITEM, vec, (s_char *)lp, EF_LAND);
        if (!player->simulation) {
+           getvec(VT_ITEM, vec, (s_char *)lp, EF_LAND);
            if ((n = feed_land(lp, vec, etus, &needed, 1)) > 0) {
                wu(0, lp->lnd_own, "%d starved in %s%s\n",
                   n, prland(lp),
index 7bf1cef19cc6a2357d5809a552c281cbdf02181a..dc81e1fcfb30bec2f1c8e09cc9a8cab86b88284f 100644 (file)
@@ -144,8 +144,8 @@ upd_ship(register struct shpstr *sp, register int etus,
        if (np->nat_level[NAT_TLEV] < sp->shp_tech * 0.85)
            mult = 2;
        cost = -(mult * etus * dmin(0.0, money_ship * mp->m_cost));
-       if ((np->nat_priorities[PRI_SMAINT] == 0 ||
-            np->nat_money < cost) && !player->simulation) {
+       if ((np->nat_priorities[PRI_SMAINT] == 0 || np->nat_money < cost)
+           && !player->simulation) {
            if ((eff = sp->shp_effic - etus / 5) < SHIP_MINEFF) {
                wu(0, sp->shp_own,
                   "%s lost to lack of maintenance\n", prship(sp));
@@ -162,36 +162,31 @@ upd_ship(register struct shpstr *sp, register int etus,
            np->nat_money -= cost;
        }
 
-       getvec(VT_ITEM, vec, (s_char *)sp, EF_SHIP);
+       if (!player->simulation) {
+           getvec(VT_ITEM, vec, (s_char *)sp, EF_SHIP);
+           sectp = getsectp(sp->shp_x, sp->shp_y);
 
-       sectp = getsectp(sp->shp_x, sp->shp_y);
-       if (((mp->m_flags & M_OIL) && (sectp->sct_type == SCT_WATER))
-           && !player->simulation) {
-           /*
-            * take care of oil production
-            */
-           oil_gained = roundavg((vec[I_CIVIL] * etus / 10000.0)
-                                 * sectp->sct_oil);
-           vec[I_OIL] += oil_gained;
-           max_oil = vl_find(V_OIL, mp->m_vtype, mp->m_vamt, mp->m_nv);
-           if (vec[I_OIL] > max_oil)
-               vec[I_OIL] = max_oil;
-           product = &pchr[P_OIL];
-           if (product->p_nrdep != 0 && oil_gained > 0) {
-               resource = ((s_char *)sectp) + product->p_nrndx;
-               *resource -= roundavg(oil_gained *
-                                     product->p_nrdep / 100.0);
+           if ((mp->m_flags & M_OIL) && sectp->sct_type == SCT_WATER) {
+               /*
+                * take care of oil production
+                */
+               oil_gained = roundavg((vec[I_CIVIL] * etus / 10000.0)
+                                     * sectp->sct_oil);
+               vec[I_OIL] += oil_gained;
+               max_oil = vl_find(V_OIL, mp->m_vtype, mp->m_vamt, mp->m_nv);
+               if (vec[I_OIL] > max_oil)
+                   vec[I_OIL] = max_oil;
+               product = &pchr[P_OIL];
+               if (product->p_nrdep != 0 && oil_gained > 0) {
+                   resource = ((s_char *)sectp) + product->p_nrndx;
+                   *resource -= roundavg(oil_gained *
+                                         product->p_nrdep / 100.0);
+               }
+           }
+           if ((mp->m_flags & M_FOOD) && sectp->sct_type == SCT_WATER) {
+               vec[I_FOOD] += ((vec[I_CIVIL] * etus) / 1000.0)
+                   * sectp->sct_fertil;
            }
-       }
-       if (((mp->m_flags & M_FOOD) && (sectp->sct_type == SCT_WATER))
-           && !player->simulation) {
-           sectp = getsectp(sp->shp_x, sp->shp_y);
-           vec[I_FOOD] += ((vec[I_CIVIL] * etus) / 1000.0)
-               * sectp->sct_fertil;
-       }
-/* Military costs are now part of regular military costs, not ship costs */
-/*             np->nat_money += (int) (etus * vec[I_MILIT] * money_mil);*/
-       if (!player->simulation) {
            if ((n = feed_ship(sp, vec, etus, &needed, 1)) > 0) {
                wu(0, sp->shp_own, "%d starved on %s\n", n, prship(sp));
                if (n > 10)