update: Move work percentage update into do_feed()
Since changing *sp is safe now, we can move the update of sp->sct_work into do_feed(), use the return value for work, and drop parameter workp. The sp->sct_avail update looks similar, but there's a subtle difference: it's skipped when the sector is stopped or its owner is broke. The caller already checks that, so leave the update there. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
4daf98a160
commit
d30de533d7
3 changed files with 8 additions and 11 deletions
|
@ -284,9 +284,8 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2])
|
|||
}
|
||||
|
||||
sp->sct_updated = 1;
|
||||
work = 0;
|
||||
|
||||
do_feed(sp, np, &work, etu);
|
||||
work = do_feed(sp, np, etu);
|
||||
bp_put_items(bp, sp);
|
||||
|
||||
if (sp->sct_off || np->nat_money < 0)
|
||||
|
@ -337,12 +336,11 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2])
|
|||
bp_put_items(bp, sp);
|
||||
}
|
||||
|
||||
sp->sct_avail = work;
|
||||
bp_put_avail(bp, sp, work);
|
||||
p_sect[desig][0] += amount;
|
||||
p_sect[desig][1] += pcost;
|
||||
if (!player->simulation) {
|
||||
sp->sct_avail = work;
|
||||
if (!player->simulation)
|
||||
np->nat_money -= pcost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue