diff --git a/include/budg.h b/include/budg.h index 389c024c..f16cd865 100644 --- a/include/budg.h +++ b/include/budg.h @@ -45,7 +45,7 @@ struct bp *bp_alloc(void); void bp_set_from_sect(struct bp *, struct sctstr *); int bp_get_item(struct bp *, struct sctstr *, i_type); void bp_put_item(struct bp *, struct sctstr *, i_type, int); -void bp_put_items(struct bp *, struct sctstr *, short *); +void bp_put_items(struct bp *, struct sctstr *); int bp_get_avail(struct bp *, struct sctstr *); void bp_put_avail(struct bp *, struct sctstr *, int); diff --git a/src/lib/update/bp.c b/src/lib/update/bp.c index ec7d24b6..877c8bd4 100644 --- a/src/lib/update/bp.c +++ b/src/lib/update/bp.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Ville Virrankoski, 1996 - * Markus Armbruster, 2007 + * Markus Armbruster, 2007-2016 */ /* @@ -99,9 +99,9 @@ bp_put_item(struct bp *bp, struct sctstr *sp, i_type comm, int amount) bp_ref(bp, sp)->bp_item[idx] = amount; } -/* Set the item values tracked in @bp for sector @sp from @vec. */ +/* Set the item values tracked in @bp from sector @sp. */ void -bp_put_items(struct bp *bp, struct sctstr *sp, short *vec) +bp_put_items(struct bp *bp, struct sctstr *sp) { enum bp_item_idx idx; struct bp *p = bp_ref(bp, sp); @@ -110,7 +110,7 @@ bp_put_items(struct bp *bp, struct sctstr *sp, short *vec) for (i = I_NONE + 1; i <= I_MAX; i++) { idx = bud_key[i]; if (idx >= 0) - p->bp_item[idx] = vec[i]; + p->bp_item[idx] = sp->sct_item[i]; } } @@ -132,7 +132,7 @@ bp_put_avail(struct bp *bp, struct sctstr *sp, int amount) void bp_set_from_sect(struct bp *bp, struct sctstr *sp) { - bp_put_items(bp, sp, sp->sct_item); + bp_put_items(bp, sp); bp_put_avail(bp, sp, sp->sct_avail); } diff --git a/src/lib/update/sect.c b/src/lib/update/sect.c index fbfac5ce..324ef911 100644 --- a/src/lib/update/sect.c +++ b/src/lib/update/sect.c @@ -288,7 +288,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2]) work = 0; do_feed(sp, np, sp->sct_item, &work, etu); - bp_put_items(bp, sp, sp->sct_item); + bp_put_items(bp, sp); if (sp->sct_off || np->nat_money < 0) continue; @@ -310,7 +310,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2]) if ((sp->sct_effic < 100 || sp->sct_type != sp->sct_newtype) && np->nat_money >= 0) { neweff = upd_buildeff(sp, &work, sp->sct_item, &desig, &cost); - bp_put_items(bp, sp, sp->sct_item); + bp_put_items(bp, sp); p_sect[SCT_EFFIC][0]++; p_sect[SCT_EFFIC][1] += cost; if (!player->simulation) { @@ -326,7 +326,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2]) p_sect[desig][1] += ecost; if (!player->simulation) np->nat_money -= ecost; - bp_put_items(bp, sp, sp->sct_item); + bp_put_items(bp, sp); } /* @@ -337,7 +337,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2]) if (np->nat_money >= 0 && dchr[desig].d_prd >= 0) work -= produce(np, sp, sp->sct_item, work, desig, neweff, &pcost, &amount); - bp_put_items(bp, sp, sp->sct_item); + bp_put_items(bp, sp); } bp_put_avail(bp, sp, work);