update: Drop redundant produce() parameter vec[]
Its caller passes sp->sct_item, so use that. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
a0a8e72150
commit
dc6799ebd5
3 changed files with 10 additions and 9 deletions
|
@ -704,7 +704,7 @@ extern int upd_slmilcosts(natid, int);
|
|||
extern void prepare_sects(int, struct bp *);
|
||||
extern int bank_income(struct sctstr *, int);
|
||||
/* produce.c */
|
||||
extern int produce(struct natstr *, struct sctstr *, short *, int, int,
|
||||
extern int produce(struct natstr *, struct sctstr *, int, int,
|
||||
int, int *, int *);
|
||||
extern int prod_materials_cost(struct pchrstr *, short[], int *);
|
||||
extern int prod_resource_limit(struct pchrstr *, unsigned char *);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* produce.c: Produce goodies
|
||||
*
|
||||
* Known contributors to this file:
|
||||
* Markus Armbruster, 2004-2013
|
||||
* Markus Armbruster, 2004-2016
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -45,7 +45,7 @@ static char *levelnames[] = {
|
|||
};
|
||||
|
||||
int
|
||||
produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
||||
produce(struct natstr *np, struct sctstr *sp, int work,
|
||||
int desig, int neweff, int *cost, int *amount)
|
||||
{
|
||||
struct pchrstr *product;
|
||||
|
@ -72,7 +72,8 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
*amount = 0;
|
||||
*cost = 0;
|
||||
|
||||
material_limit = prod_materials_cost(product, vec, &unit_work);
|
||||
material_limit = prod_materials_cost(product, sp->sct_item,
|
||||
&unit_work);
|
||||
if (material_limit <= 0)
|
||||
return 0;
|
||||
|
||||
|
@ -122,8 +123,8 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
actual = 999;
|
||||
material_consume = roundavg(actual / prodeff);
|
||||
}
|
||||
if (vec[item] + actual > ITEM_MAX) {
|
||||
actual = ITEM_MAX - vec[item];
|
||||
if (sp->sct_item[item] + actual > ITEM_MAX) {
|
||||
actual = ITEM_MAX - sp->sct_item[item];
|
||||
material_consume = roundavg(actual / prodeff);
|
||||
if (material_consume < 0)
|
||||
material_consume = 0;
|
||||
|
@ -132,13 +133,13 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
"%s production backlog in %s\n",
|
||||
product->p_name, ownxy(sp));
|
||||
}
|
||||
vec[item] += actual;
|
||||
sp->sct_item[item] += actual;
|
||||
}
|
||||
/*
|
||||
* Reset produced amount by commodity production ratio
|
||||
*/
|
||||
if (!player->simulation) {
|
||||
materials_charge(product, vec, material_consume);
|
||||
materials_charge(product, sp->sct_item, material_consume);
|
||||
if (resource && product->p_nrdep != 0) {
|
||||
/*
|
||||
* lower natural resource in sector depending on
|
||||
|
|
|
@ -335,7 +335,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2])
|
|||
|
||||
if (neweff >= 60) {
|
||||
if (np->nat_money >= 0 && dchr[desig].d_prd >= 0)
|
||||
work -= produce(np, sp, sp->sct_item, work, desig, neweff,
|
||||
work -= produce(np, sp, work, desig, neweff,
|
||||
&pcost, &amount);
|
||||
bp_put_items(bp, sp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue