]> git.pond.sub.org Git - empserver/commitdiff
Don't use automatic supply to avoid starvation at the update
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 12 Feb 2009 06:39:46 +0000 (07:39 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 15 Feb 2009 11:51:05 +0000 (12:51 +0100)
Food supply during update adds complexity to the update.  How much
good it does to players is highly doubtful; certainly nobody can rely
on it.  It isn't covered by the starvation command.  Starving ships or
land units can steal enough food from their sector to make it starve,
too.  Finally, the supply code is notoriously hard to use correctly.
We don't know of issues with the update's use, but we haven't
convinced ourselves that there aren't any either.

info/Food.t
info/Land-units.t
info/Update-sequence.t
info/starvation.t
info/supply.t
src/lib/update/human.c
src/lib/update/land.c
src/lib/update/sect.c
src/lib/update/ship.c

index afc1cebec8eaecce9413b6e257978a04c061c2ca..61ffcc98c856b0e8dc0231635b2af779cbb342ad 100644 (file)
@@ -125,16 +125,9 @@ in one time unit is:
 0
 .in
 .s1
-Note that if a ship doesn't have enough food, it will try to draw it from
-supply sources (see info supply). If it still hasn't enough food, it will
+Note that if a ship doesn't have enough food, it will
 attempt to grab unneeded food from any land units it is carrying.
 .s1
-Land units eat food as well, an amount based on the total number of military
-in the unit (this is the efficiency times the number of mil needed to build
-the unit). If a land unit doesn't have enough food, it will try to draw it
-from supply sources (see info supply). If it still doesn't have enough, and
-it is on a ship, it will attempt to get food from the ship.
-.s1
 The presence of food also affects the birthrate in Empire;
 if there is no food in a sector no babies will be born.
 A baby consumes 0.3 units of food in growing to adulthood.
index 0c37c502a1d54a0aa3734f660e16e5df0ee406f0..00252351af8f783e2e36088909a141132e88183a 100644 (file)
@@ -230,10 +230,7 @@ used in assaulting sectors. (See info \*Qassault\*U)
 .s1
 .L Supply
 .s1
-Units need supplies in order to attack. Each update, and each time they
-attack, units will attempt to draw supplies. See info \*Qsupply\*U.
-Really, I'm serious. If you don't read info \*Qsupply\*U, you'll die a horrible
-death. I'm not kidding.
+Units need supplies in order to attack.  See info \*Qsupply\*U.
 .s1
 .L Fortification
 .s1
index f0e1de3977b59cbdbdc4ebbff534ab94416491ce..cb431c09f14da9dea4d0b1d8a33c091daab53a8c 100644 (file)
@@ -27,14 +27,10 @@ This document gives a rough order of events during the update.
                 a) if the sector is a cap, it costs $1 per etu since
                        the last update
                 b) people in non-sanctuary sectors eat
-                        1) If not enough is available, the sector
-                                uses the supply routines to draw more.
-                        2) If still not enough is available,
-                                the excess people will starve off.
-                                a) No more than 50% of the people
-                                        in a sect can die;
-                                        the uw's die first, then
-                                        the civs, then the mil.
+                        If not enough is available, the excess people will
+                       starve off.  No more than 50% of the people
+                        in a sector can die; the uw's die first, then
+                        the civs, then the mil.
                 c) if there was starvation, the work percentage is set
                         to 0, otherwise the work rate rises by
                         8+(1-15), max of 100
index 9766571b52b55c2d806b403111bd02e03f56d9eb..f5ef18f9c678b2a8980416ff1cd3f4a5113468d3 100644 (file)
@@ -11,7 +11,7 @@ sectors, land units, and ships that will starve at the update.
 .s1
 With this syntax, the starvation command displays all sectors in
 <SECTS> that currently do not have enough food. It does not take into account
-emergency food growing & supplying (see info supply)
+emergency food growing.
 It also does not worry about feeding babies... it merely
 check for starvation. If you want population increase,
 you'll need to chuck in some extra food...
index 35ff4fea8543176ebbcbc8e5f764e88a46af7046..ef4c52fa755f67f7be49c0f50f680eb3824771bf 100644 (file)
@@ -26,15 +26,11 @@ A unit that fights may use a basic load of supplies
 to attack with.  (depending on the intensity of combat. The more intense the
 combat, the more chance the unit will use a basic load of supplies)
 .s1
-During the update, each unit will attempt to draw food supplies just before
-starvation is calculated.
-.s1
 When a unit needs to draw supplies, such as when you use the supply command,
 or the unit wishes to attack, or is attacked, etc, it must attempt to get
 them from supply sources. Other things may use the same routines, such as
-loyal sectors, which will draw food from supply sources when in danger of
-starvation, and ships/forts/sectors, which will draw shells when they need
-them to fire defensively.
+ships/forts/sectors, which will draw shells when they need them to
+fire defensively.
 .s1
 .L "Supply Sources"
 .s1
@@ -89,7 +85,4 @@ OTHER USES OF SUPPLY
 In general, when any land unit/ship/fort needs shells, it will attempt to
 draw them before use, if it does not already have them.
 .s1
-Also, units/ships/sectors will use supply sources to get enough food during
-the update so that they do not starve.
-.s1
 .SA "lload, LandUnits"
index f4236e34fb548b403e5dc495e6f3596f4b2afd02..18a1e68e1419f2c9d6f24122dfa55c938436d227 100644 (file)
@@ -84,13 +84,6 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
                    /* Conjure up 1f to make life easier for the player */
                    manna = vec[I_FOOD] = 1;
            }
-           if (vec[I_FOOD] < needed && sp->sct_own == sp->sct_oldown) {
-               /* steal food from warehouses, headquarters,
-                  supply ships in port, or supply units */
-               vec[I_FOOD] = supply_commod(sp->sct_own,
-                                           sp->sct_x, sp->sct_y,
-                                           I_FOOD, needed);
-           }
        }
        starved = feed_people(vec, etu);
        if (starved > 0) {
index c9626379c921752972d0ba8e2d664f37e256cd72..32d03a3a5c5f544cd995ad96ce3ec234d9058981 100644 (file)
@@ -59,9 +59,7 @@ prod_land(int etus, int natnum, struct bp *bp, int build)
     struct natstr *np;
     int n, k = 0;
     int start_money;
-    int lastx = 9999, lasty = 9999;
 
-    bp_enable_cachepath();
     for (n = 0; NULL != (lp = getlandp(n)); n++) {
        if (lp->lnd_own == 0)
            continue;
@@ -77,16 +75,6 @@ prod_land(int etus, int natnum, struct bp *bp, int build)
        sp = getsectp(lp->lnd_x, lp->lnd_y);
        if (sp->sct_type == SCT_SANCT)
            continue;
-       if (lastx == 9999 || lasty == 9999) {
-           lastx = lp->lnd_x;
-           lasty = lp->lnd_y;
-       }
-       if (lastx != lp->lnd_x || lasty != lp->lnd_y) {
-           /* Reset the cache */
-           bp_disable_cachepath();
-           bp_clear_cachepath();
-           bp_enable_cachepath();
-       }
        np = getnatp(lp->lnd_own);
        start_money = np->nat_money;
        upd_land(lp, etus, np, bp, build);
@@ -96,8 +84,6 @@ prod_land(int etus, int natnum, struct bp *bp, int build)
        if (player->simulation)
            np->nat_money = start_money;
     }
-    bp_disable_cachepath();
-    bp_clear_cachepath();
 
     return k;
 }
@@ -285,16 +271,5 @@ landrepair(struct lndstr *land, struct natstr *np, struct bp *bp, int etus)
 static int
 feed_land(struct lndstr *lp, int etus)
 {
-    int needed;
-
-    if (opt_NOFOOD)
-       return 0;
-
-    needed = (int)ceil(food_needed(lp->lnd_item, etus));
-
-    /* scrounge */
-    if (needed > lp->lnd_item[I_FOOD])
-       resupply_commod(lp, I_FOOD);
-
     return feed_people(lp->lnd_item, etus);
 }
index 6bf812519b487f166ae7261dc468ddf9d2b1f96e..6b310a1b3869f9d3065ef849800ad0650cf58f95 100644 (file)
@@ -308,16 +308,9 @@ produce_sect(int natnum, int etu, struct bp *bp, long p_sect[][2])
        sp->sct_updated = 1;
        work = 0;
 
-       /* do_feed trys to supply.  So, we need to enable cacheing
-          here */
-       bp_enable_cachepath();
-
        sctwork = do_feed(sp, np, vec, &work, etu);
        bp_put_items(bp, sp, vec);
 
-       bp_disable_cachepath();
-       bp_clear_cachepath();
-
        if (sp->sct_off || np->nat_money < 0)
            continue;
 
index 891a8c7edd533f9ce0cfe3a95c107cfa6b819798..edc41b89423fa30aa99fe96e88db747135237b8e 100644 (file)
@@ -59,9 +59,7 @@ prod_ship(int etus, int natnum, struct bp *bp, int build)
     struct natstr *np;
     int n, k = 0;
     int start_money;
-    int lastx = 9999, lasty = 9999;
 
-    bp_enable_cachepath();
     for (n = 0; NULL != (sp = getshipp(n)); n++) {
        if (sp->shp_own == 0)
            continue;
@@ -75,16 +73,6 @@ prod_ship(int etus, int natnum, struct bp *bp, int build)
        }
 
        np = getnatp(sp->shp_own);
-       if (lastx == 9999 || lasty == 9999) {
-           lastx = sp->shp_x;
-           lasty = sp->shp_y;
-       }
-       if (lastx != sp->shp_x || lasty != sp->shp_y) {
-           /* Reset the cache */
-           bp_disable_cachepath();
-           bp_clear_cachepath();
-           bp_enable_cachepath();
-       }
        start_money = np->nat_money;
        upd_ship(sp, etus, np, bp, build);
        if (build && !player->simulation)       /* make sure to only autonav once */
@@ -382,10 +370,6 @@ feed_ship(struct shpstr *sp, int etus)
     needed = (int)ceil(food_needed(sp->shp_item, etus));
 
     /* scrounge */
-    if (needed > sp->shp_item[I_FOOD])
-       sp->shp_item[I_FOOD] += supply_commod(sp->shp_own,
-                                       sp->shp_x, sp->shp_y, I_FOOD,
-                                       needed - sp->shp_item[I_FOOD]);
     if (needed > sp->shp_item[I_FOOD]) {
        /* take from embarked land units, but don't starve them */
        snxtitem_cargo(&ni, EF_LAND, EF_SHIP, sp->shp_uid);