Skip to content

Commit

Permalink
Use ternary expression instead of 6-liner
Browse files Browse the repository at this point in the history
  • Loading branch information
wapcaplet committed Feb 8, 2020
1 parent 780e969 commit 3ffc4f0
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3296,13 +3296,7 @@ void item::final_info( std::vector<iteminfo> &info, const iteminfo_query *parts,

// list recipes you could use it in
if( parts->test( iteminfo_parts::DESCRIPTION_APPLICABLE_RECIPES ) ) {
itype_id tid;
if( contents.empty() ) { // use this item
tid = typeId();
} else { // use the contained item
tid = contents.front().typeId();
}

itype_id tid = contents.empty() ? typeId() : contents.front().typeId();
const inventory &crafting_inv = g->u.crafting_inventory();
const recipe_subset available_recipe_subset = g->u.get_available_recipes( crafting_inv );
const std::set<const recipe *> &item_recipes = available_recipe_subset.of_component( tid );
Expand Down

0 comments on commit 3ffc4f0

Please sign in to comment.