Skip to content

Commit

Permalink
Merge pull request #47869 from Jamuro-g/Fix-disassembly-component-dis…
Browse files Browse the repository at this point in the history
…play

fix disassembly component display
  • Loading branch information
Rivet-the-Zombie authored Mar 5, 2021
2 parents 74a732f + 68daf0d commit 5960368
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10616,7 +10616,15 @@ std::vector<item_comp> 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;
Expand Down

0 comments on commit 5960368

Please sign in to comment.