From 632e4ede908422d3eb10ecdc1be53f2dbfb43d1a Mon Sep 17 00:00:00 2001 From: Kamayana Date: Sun, 27 Nov 2022 13:26:49 -0600 Subject: [PATCH 1/3] Added bool setting for numeric item shortcuts. --- src/inventory_ui.cpp | 2 +- src/options.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/inventory_ui.cpp b/src/inventory_ui.cpp index 2afff8da8ec7b..4bf97877e30c6 100644 --- a/src/inventory_ui.cpp +++ b/src/inventory_ui.cpp @@ -1961,7 +1961,7 @@ void inventory_selector::prepare_layout( size_t client_width, size_t client_heig void inventory_selector::reassign_custom_invlets() { - if( invlet_type_ == SELECTOR_INVLET_DEFAULT || invlet_type_ == SELECTOR_INVLET_NUMERIC ) { + if( ( invlet_type_ == SELECTOR_INVLET_DEFAULT || invlet_type_ == SELECTOR_INVLET_NUMERIC ) && get_option("ITEM_NUMERIC_SHORTCUTS") ) { int min_invlet = static_cast( use_invlet ? '0' : '\0' ); for( inventory_column *elem : columns ) { elem->prepare_paging(); diff --git a/src/options.cpp b/src/options.cpp index ee47fa8a0f01e..4e2e1a16752bb 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1941,6 +1941,11 @@ void options_manager::add_options_interface() }, "favorites" ); + add("ITEM_NUMERIC_SHORTCUTS", "interface", to_translation("Use Numeric Item Shortcuts"), + to_translation("If true, assign numeric shortcuts to the first ten items outside of the inventory in item interaction menus."), + true + ); + add( "ITEM_HEALTH_BAR", "interface", to_translation( "Show item health bars" ), // NOLINTNEXTLINE(cata-text-style): one space after "etc." to_translation( "If true, show item health bars instead of reinforced, scratched etc. text." ), From c0b1bf8e533aeda485b6b919282483a98be901c7 Mon Sep 17 00:00:00 2001 From: Kamayana Date: Sun, 27 Nov 2022 12:27:20 -0800 Subject: [PATCH 2/3] Update src/options.cpp Fixing whitespacing. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/options.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index 4e2e1a16752bb..ed82704795209 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1941,10 +1941,10 @@ void options_manager::add_options_interface() }, "favorites" ); - add("ITEM_NUMERIC_SHORTCUTS", "interface", to_translation("Use Numeric Item Shortcuts"), - to_translation("If true, assign numeric shortcuts to the first ten items outside of the inventory in item interaction menus."), - true - ); + add( "ITEM_NUMERIC_SHORTCUTS", "interface", to_translation( "Use Numeric Item Shortcuts" ), + to_translation( "If true, assign numeric shortcuts to the first ten items outside of the inventory in item interaction menus." ), + true + ); add( "ITEM_HEALTH_BAR", "interface", to_translation( "Show item health bars" ), // NOLINTNEXTLINE(cata-text-style): one space after "etc." From 6d94be0d2a5aff1399ccec05c328f63003e01d21 Mon Sep 17 00:00:00 2001 From: Kamayana Date: Sun, 27 Nov 2022 12:29:10 -0800 Subject: [PATCH 3/3] Update src/inventory_ui.cpp Fix overly long line. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/inventory_ui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inventory_ui.cpp b/src/inventory_ui.cpp index 4bf97877e30c6..f863e32aab9d5 100644 --- a/src/inventory_ui.cpp +++ b/src/inventory_ui.cpp @@ -1961,7 +1961,8 @@ void inventory_selector::prepare_layout( size_t client_width, size_t client_heig void inventory_selector::reassign_custom_invlets() { - if( ( invlet_type_ == SELECTOR_INVLET_DEFAULT || invlet_type_ == SELECTOR_INVLET_NUMERIC ) && get_option("ITEM_NUMERIC_SHORTCUTS") ) { + if( ( invlet_type_ == SELECTOR_INVLET_DEFAULT || invlet_type_ == SELECTOR_INVLET_NUMERIC ) && + get_option( "ITEM_NUMERIC_SHORTCUTS" ) ) { int min_invlet = static_cast( use_invlet ? '0' : '\0' ); for( inventory_column *elem : columns ) { elem->prepare_paging();