(bp_put_items): New.
(bp_set_from_sect): Use it.
This commit is contained in:
parent
613e71acb3
commit
1fb2336a53
2 changed files with 18 additions and 10 deletions
|
@ -43,6 +43,7 @@ struct bp *bp_alloc(void);
|
||||||
void bp_set_from_sect(struct bp *, struct sctstr *);
|
void bp_set_from_sect(struct bp *, struct sctstr *);
|
||||||
int bp_get_item(struct bp *, struct sctstr *, i_type);
|
int bp_get_item(struct bp *, struct sctstr *, i_type);
|
||||||
void bp_put_item(struct bp *, struct sctstr *, i_type, int);
|
void bp_put_item(struct bp *, struct sctstr *, i_type, int);
|
||||||
|
void bp_put_items(struct bp *, struct sctstr *, short *);
|
||||||
int bp_get_avail(struct bp *, struct sctstr *);
|
int bp_get_avail(struct bp *, struct sctstr *);
|
||||||
void bp_put_avail(struct bp *, struct sctstr *, int);
|
void bp_put_avail(struct bp *, struct sctstr *, int);
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,21 @@ bp_put_item(struct bp *bp, struct sctstr *sp, i_type comm, int amount)
|
||||||
bp_ref(bp, sp)->bp_item[idx] = amount;
|
bp_ref(bp, sp)->bp_item[idx] = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set the item values tracked in BP for sector SP from VEC. */
|
||||||
|
void
|
||||||
|
bp_put_items(struct bp *bp, struct sctstr *sp, short *vec)
|
||||||
|
{
|
||||||
|
enum bp_item_idx idx;
|
||||||
|
struct bp *p = bp_ref(bp, sp);
|
||||||
|
i_type i;
|
||||||
|
|
||||||
|
for (i = I_NONE + 1; i <= I_MAX; i++) {
|
||||||
|
idx = bud_key[i];
|
||||||
|
if (idx >= 0)
|
||||||
|
p->bp_item[idx] = sp->sct_item[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Return avail tracked in BP for sector SP. */
|
/* Return avail tracked in BP for sector SP. */
|
||||||
int
|
int
|
||||||
bp_get_avail(struct bp *bp, struct sctstr *sp)
|
bp_get_avail(struct bp *bp, struct sctstr *sp)
|
||||||
|
@ -116,16 +131,8 @@ bp_put_avail(struct bp *bp, struct sctstr *sp, int amount)
|
||||||
void
|
void
|
||||||
bp_set_from_sect(struct bp *bp, struct sctstr *sp)
|
bp_set_from_sect(struct bp *bp, struct sctstr *sp)
|
||||||
{
|
{
|
||||||
enum bp_item_idx idx;
|
bp_put_items(bp, sp, sp->sct_item);
|
||||||
struct bp *p = bp_ref(bp, sp);
|
bp_put_avail(bp, sp, sp->sct_avail);
|
||||||
i_type i;
|
|
||||||
|
|
||||||
for (i = I_NONE + 1; i <= I_MAX; i++) {
|
|
||||||
idx = bud_key[i];
|
|
||||||
if (idx >= 0)
|
|
||||||
p->bp_item[idx] = sp->sct_item[i];
|
|
||||||
}
|
|
||||||
p->bp_avail = sp->sct_avail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue