From 98849f6afb8e216000f6c642d9c9ffa26a58bd4c Mon Sep 17 00:00:00 2001 From: gramanas Date: Mon, 20 Dec 2021 23:07:21 +0200 Subject: Fix distinct sum --- src/types.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/types.c b/src/types.c index 3e720b8..dbc7458 100644 --- a/src/types.c +++ b/src/types.c @@ -330,9 +330,12 @@ distinct_sum_items(recipe * dst, recipe * src) void merge_items(recipe * dst, recipe * src) { - /* Join all items in src's subrecipes to dst */ - join_subrecipe_items(dst, src); - /* Copy src items as well to dst */ - copy_items(dst, src); - distinct_sum_items(dst, dst); + recipe * _r = new_recipe(); + /* Join all items in src's subrecipes to tmp */ + join_subrecipe_items(_r, src); + /* Copy src items as well to tmp */ + copy_items(_r, src); + /* disticnt items to dst */ + distinct_sum_items(dst, _r); + free_recipe(_r); } -- cgit v1.2.3