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)
This commit is contained in:
Pasi Kallinen
2024-05-06 12:00:31 +03:00
parent cc6d04519c
commit 312a4bcd26

View File

@@ -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);