(alloc_bp, bp_alloc): Rename.
(fill_update_array, bp_set_from_sect): Rename. (gt_bg_nmbr, pt_bg_nmbr, bp_get_item, bp_get_avail, bp_put_item, bp_put_avail): Separate accessor functions for item and avail.
This commit is contained in:
parent
ec203e88ad
commit
c9c06d4fbe
11 changed files with 50 additions and 34 deletions
|
@ -55,7 +55,7 @@ get_materials(struct sctstr *sp, struct bp *bp, int *mvec, int pct)
|
|||
for (i = I_NONE + 1; i <= I_MAX; i++) {
|
||||
if (mvec[i] == 0)
|
||||
continue;
|
||||
amt = gt_bg_nmbr(bp, sp, i);
|
||||
amt = bp_get_item(bp, sp, i);
|
||||
if (amt * 100 < mvec[i] * pct)
|
||||
pct = amt * 100 / mvec[i];
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ get_materials(struct sctstr *sp, struct bp *bp, int *mvec, int pct)
|
|||
for (i = I_NONE + 1; i <= I_MAX; i++) {
|
||||
if (mvec[i] == 0)
|
||||
continue;
|
||||
amt = gt_bg_nmbr(bp, sp, i);
|
||||
amt = bp_get_item(bp, sp, i);
|
||||
amt -= roundavg(mvec[i] * pct / 100.0);
|
||||
if (CANT_HAPPEN(amt < 0))
|
||||
amt = 0;
|
||||
pt_bg_nmbr(bp, sp, i, amt);
|
||||
bp_put_item(bp, sp, i, amt);
|
||||
if (!player->simulation)
|
||||
sp->sct_item[i] = amt;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue