From 43fc32a365bd5b6c13f8cac0213a9fa04b050182 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 4 Jun 2016 08:56:57 +0200 Subject: [PATCH] update: Drop redundant produce() parameters desig, neweff Its caller passes sp->sct_type and sp->sct_effic, so use that. Signed-off-by: Markus Armbruster --- include/prototypes.h | 2 +- src/lib/update/produce.c | 11 +++++------ src/lib/update/sect.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index 10f39695..564ace37 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -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 *, int, int, int *); +extern int produce(struct natstr *, struct sctstr *, int *); extern int prod_materials_cost(struct pchrstr *, short[], int *); extern int prod_resource_limit(struct pchrstr *, unsigned char *); extern double prod_eff(int, float); diff --git a/src/lib/update/produce.c b/src/lib/update/produce.c index 343a0aaf..38fafef1 100644 --- a/src/lib/update/produce.c +++ b/src/lib/update/produce.c @@ -45,8 +45,7 @@ static char *levelnames[] = { }; int -produce(struct natstr *np, struct sctstr *sp, - int desig, int neweff, int *cost) +produce(struct natstr *np, struct sctstr *sp, int *cost) { struct pchrstr *product; double p_e; @@ -61,9 +60,9 @@ produce(struct natstr *np, struct sctstr *sp, int material_consume; int val; - if (dchr[desig].d_prd < 0) + if (dchr[sp->sct_type].d_prd < 0) return 0; - product = &pchr[dchr[desig].d_prd]; + product = &pchr[dchr[sp->sct_type].d_prd]; item = product->p_type; if (product->p_nrndx) resource = (unsigned char *)sp + product->p_nrndx; @@ -77,7 +76,7 @@ produce(struct natstr *np, struct sctstr *sp, return 0; /* sector p.e. */ - p_e = neweff / 100.0; + p_e = sp->sct_effic / 100.0; if (resource) { unit_work++; p_e *= *resource / 100.0; @@ -96,7 +95,7 @@ produce(struct natstr *np, struct sctstr *sp, if (material_consume == 0) return 0; - prodeff = prod_eff(desig, np->nat_level[product->p_nlndx]); + prodeff = prod_eff(sp->sct_type, np->nat_level[product->p_nlndx]); if (prodeff <= 0.0 && !player->simulation) { wu(0, sp->sct_own, "%s level too low to produce in %s (need %d)\n", diff --git a/src/lib/update/sect.c b/src/lib/update/sect.c index d8ae7c4d..3394a652 100644 --- a/src/lib/update/sect.c +++ b/src/lib/update/sect.c @@ -327,7 +327,7 @@ produce_sect(struct natstr *np, int etu, struct bp *bp, int p_sect[][2]) if (sp->sct_effic >= 60) { if (np->nat_money >= 0 && dchr[sp->sct_type].d_prd >= 0) - amount = produce(np, sp, sp->sct_type, sp->sct_effic, &pcost); + amount = produce(np, sp, &pcost); bp_put_items(bp, sp); }