Skip to content

Commit

Permalink
fix: Re-add missing show_unavailable in recipes (#4766)
Browse files Browse the repository at this point in the history
Re-add missing show_unavailable in recipes
  • Loading branch information
Coolthulhu authored Jun 9, 2024
1 parent df122a4 commit d82b4a5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/crafting_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ static std::vector<std::string> recipe_info(
const recipe &recp,
const availability &avail,
player &u,
bool show_unavailable,
const std::string qry_comps,
const int batch_size,
const int fold_width,
Expand Down Expand Up @@ -267,7 +268,6 @@ static std::vector<std::string> recipe_info(

std::vector<std::string> result = foldstring( oss.str(), fold_width );

bool show_unavailable = false;
const requirement_data &req = recp.simple_requirements();
const std::vector<std::string> tools = req.get_folded_tools_list(
fold_width, color, crafting_inv, batch_size );
Expand All @@ -279,6 +279,7 @@ static std::vector<std::string> recipe_info(
oss = std::ostringstream();
if( !u.knows_recipe( &recp ) ) {
oss << _( "Recipe not memorized yet\n" );
oss << _( "id: " ) << recp.ident() << "\n";
const std::set<itype_id> books_with_recipe = show_unavailable
? crafting::get_books_for_recipe( &recp )
: crafting::get_books_for_recipe( u, crafting_inv, &recp );
Expand All @@ -287,6 +288,7 @@ static std::vector<std::string> recipe_info(
[]( const itype_id & type_id ) {
return colorize( item::nname( type_id ), c_cyan );
} );
oss << _( "book count: " ) << books_with_recipe.size() << "\n";
oss << string_format( _( "Written in: %s\n" ), enumerated_books );
}
std::vector<std::string> tmp = foldstring( oss.str(), fold_width );
Expand All @@ -311,6 +313,7 @@ const recipe *select_crafting_recipe( int &batch_size_out )
const recipe & recp,
const availability & avail,
player & u,
bool show_unavailable,
const std::string qry_comps,
const int batch_size,
const int fold_width,
Expand All @@ -326,7 +329,7 @@ const recipe *select_crafting_recipe( int &batch_size_out )
recipe_info_cache.batch_size = batch_size;
recipe_info_cache.fold_width = fold_width;
recipe_info_cache.text = recipe_info(
recp, avail, u, qry_comps, batch_size, fold_width, color );
recp, avail, u, show_unavailable, qry_comps, batch_size, fold_width, color );
}
return recipe_info_cache.text;
};
Expand Down Expand Up @@ -561,7 +564,7 @@ const recipe *select_crafting_recipe( int &batch_size_out )
}

const std::vector<std::string> &info = cached_recipe_info(
recp, avail, u, qry_comps, batch_size, fold_width, color );
recp, avail, u, show_unavailable, qry_comps, batch_size, fold_width, color );

const int total_lines = info.size();
if( recipe_info_scroll < 0 ) {
Expand Down

0 comments on commit d82b4a5

Please sign in to comment.