Don't use automatic supply to avoid starvation at the update
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.
This commit is contained in:
parent
c0b300d875
commit
7da69c92e0
9 changed files with 9 additions and 85 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue