Use new snxtitem_cargo() to simplify a couple of loops
Change snxtitem_all() loops that skip everything but a carrier's cargo to use snxtitem_cargo() in scra(), scuttle_ship(), scuttle_land(), takeover_ship(), takeover_land(), trade_desc(), feed_ship().
This commit is contained in:
parent
3cf29456fe
commit
2a9b89693e
5 changed files with 138 additions and 198 deletions
|
@ -388,10 +388,8 @@ feed_ship(struct shpstr *sp, int etus)
|
|||
needed - sp->shp_item[I_FOOD]);
|
||||
if (needed > sp->shp_item[I_FOOD]) {
|
||||
/* take from embarked land units, but don't starve them */
|
||||
snxtitem_all(&ni, EF_LAND);
|
||||
snxtitem_cargo(&ni, EF_LAND, EF_SHIP, sp->shp_uid);
|
||||
while ((lp = nxtitemp(&ni)) && needed > sp->shp_item[I_FOOD]) {
|
||||
if (lp->lnd_ship != sp->shp_uid)
|
||||
continue;
|
||||
give = lp->lnd_item[I_FOOD] - food_needed(lp->lnd_item, etus);
|
||||
if (give < 1.0)
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue