From 02d380d74fb9ce56e64e37e60d5faf5a950f7914 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 16 Mar 2004 19:25:13 +0000 Subject: [PATCH] (produce): Fix consumed materials when production hits the 999 limit. This can't happen currently, because produce() never gets called with work>999. (produce): Fix rounding of consumed materials on production backlog. Broken by the previous revision. --- src/lib/update/produce.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/update/produce.c b/src/lib/update/produce.c index 0d459431..c2580b10 100644 --- a/src/lib/update/produce.c +++ b/src/lib/update/produce.c @@ -135,17 +135,16 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work, actual = *resource * 100 / product->p_nrdep; } if (actual > 999) { + material_consume = roundavg(999.0 * material_consume / actual); actual = 999; - material_consume = (int)(actual / (product->p_effic * 0.01)); } if (vec[item] + actual > ITEM_MAX) { - material_consume = - roundavg((ITEM_MAX - vec[item]) * material_consume / actual); + material_consume = roundavg((double)(ITEM_MAX - vec[item]) + * material_consume / actual); if (material_consume < 0) material_consume = 0; vec[item] = ITEM_MAX; - if (( /* vtype != V_FOOD && */ sp->sct_own) && - (!player->simulation)) + if (sp->sct_own && !player->simulation) wu(0, sp->sct_own, "%s production backlog in %s\n", product->p_name, ownxy(sp));