From 312a4bcd266aa4dc7966ee20598b41267826f07a Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 6 May 2024 12:00:31 +0300 Subject: [PATCH] Fix weight of merged partially eaten food Due to integer rounding, merging two partially eaten food rations will have wrong weight if we add the old weights together. Recalculate the weight instead. quan = 1, weight = 6 (6.675) quan = 2, weight = 13 (13.35) --- src/invent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invent.c b/src/invent.c index f16525538..4c5bcf9d7 100644 --- a/src/invent.c +++ b/src/invent.c @@ -848,7 +848,7 @@ merged(struct obj **potmp, struct obj **pobj) otmp->owt = weight(otmp), otmp->bknown = 0; /* and puddings!!!1!!one! */ else if (!Is_pudding(otmp)) - otmp->owt += obj->owt; + otmp->owt = weight(otmp); if (!has_oname(otmp) && has_oname(obj)) otmp = *potmp = oname(otmp, ONAME(obj), ONAME_SKIP_INVUPD); obj_extract_self(obj);