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 and VuradoZ committed Apr 3, 2021
1 parent 8f5929f commit 2d4f217
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 @@ -9503,7 +9503,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 2d4f217

Please sign in to comment.