Skip to content

Commit

Permalink
add a recipe filter for activity level (CleverRaven#67771)
Browse files Browse the repository at this point in the history
Co-authored-by: mqrause <[email protected]>
  • Loading branch information
mqrause and mqrause authored Aug 19, 2023
1 parent f47900d commit 6b15a5c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/crafting_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,10 @@ static recipe_subset filter_recipes( const recipe_subset &available_recipes,
break;
}

case 'a':
filtered_recipes = filtered_recipes.reduce( qry_filter_str.substr( 2 ),
recipe_subset::search_type::activity_level, progress_callback );
break;
default:
break;
}
Expand Down Expand Up @@ -978,6 +982,7 @@ static const std::vector<SearchPrefix> prefixes = {
{ 'P', to_translation( "Blacksmithing" ), to_translation( "<color_cyan>proficiency</color> used to craft" ) },
{ 'l', to_translation( "5" ), to_translation( "<color_cyan>difficulty</color> of the recipe as a number or range" ) },
{ 'r', to_translation( "buttermilk" ), to_translation( "recipe's (<color_cyan>by</color>)<color_cyan>products</color>; use * as wildcard" ) },
{ 'a', to_translation( "brisk" ), to_translation( "recipe's <color_cyan>activity level</color>" ) }
};

static const translation filter_help_start = to_translation(
Expand Down
4 changes: 4 additions & 0 deletions src/recipe_dictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "cata_algo.h"
#include "cata_utility.h"
#include "crafting_gui.h"
#include "display.h"
#include "debug.h"
#include "init.h"
#include "item.h"
Expand Down Expand Up @@ -276,6 +277,9 @@ std::vector<const recipe *> recipe_subset::search(
}
}

case search_type::activity_level:
return lcmatch( display::activity_level_str( r->exertion_level() ), txt );

default:
return false;
}
Expand Down
1 change: 1 addition & 0 deletions src/recipe_dictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class recipe_subset
description_result,
proficiency,
difficulty,
activity_level
};

/** Find marked favorite recipes */
Expand Down

0 comments on commit 6b15a5c

Please sign in to comment.