From c82eab498bbb79ad197d3ccce99fae1bc775e16a Mon Sep 17 00:00:00 2001 From: Jamuro-g Date: Thu, 4 Mar 2021 18:08:47 +0100 Subject: [PATCH 1/2] fix disassembly component display --- src/item.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/item.cpp b/src/item.cpp index e7f6fab8db13c..4fc6e5eddbbe5 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -10616,7 +10616,15 @@ std::vector item::get_uncraft_components() const } else { //Make a new vector of components from the registered components for( const item &component : components ) { - ret.push_back( item_comp( component.typeId(), component.count() ) ); + auto iter = std::find_if( ret.begin(), ret.end(), [component]( item_comp &obj ) { + return obj.type == component.typeId(); + } ); + + if( iter != ret.end() ) { + iter->count += component.count(); + } else { + ret.push_back( item_comp( component.typeId(), component.count() ) ); + } } } return ret; From 68daf0dbcfa376bde396b71f2ade5dccc6e6a5b4 Mon Sep 17 00:00:00 2001 From: Jamuro-g Date: Thu, 4 Mar 2021 18:20:39 +0100 Subject: [PATCH 2/2] astyle --- src/item.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/item.cpp b/src/item.cpp index 4fc6e5eddbbe5..066308f95a1ee 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -10616,10 +10616,10 @@ std::vector item::get_uncraft_components() const } else { //Make a new vector of components from the registered components for( const item &component : components ) { - auto iter = std::find_if( ret.begin(), ret.end(), [component]( item_comp &obj ) { + auto iter = std::find_if( ret.begin(), ret.end(), [component]( item_comp & obj ) { return obj.type == component.typeId(); } ); - + if( iter != ret.end() ) { iter->count += component.count(); } else {