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 *);
* produce.c: Produce goodies
*
* Known contributors to this file:
- * Markus Armbruster, 2004-2013
+ * Markus Armbruster, 2004-2016
*/
#include <config.h>
};
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;
*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;
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;
"%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
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);
}