Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inv_ui: fix category toggle of disabled entries #62226

Merged
merged 1 commit into from
Nov 20, 2022

Conversation

andrei8l
Copy link
Contributor

Summary

None

Purpose of change

Disabled entries in inventory UIs can be selected in category mode
Fixes: #62221

Describe the solution

Enforce the selected/highlighted distinction a little better

Describe alternatives you've considered

N/A

Testing

Trade with Rubik, turn on category selection mode, then highlight and select a CBM. The rejected CBMs shouldn't be highlighted or selected
Highlight one of the rejected CBMs and try again

Additional context

N/A

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Nov 15, 2022
@dseguin dseguin merged commit 3f031bc into CleverRaven:master Nov 20, 2022
@Ilysen
Copy link
Contributor

Ilysen commented Nov 20, 2022

This PR appears to have introduced a CTD that happens whenever you attempt to wield or wear an item from the Pickup menu that you can't fit into your inventory. The issue doesn't happen if the changes to inventory_ui.cpp are reverted back to the old version. Stacktrace and whatnot coming in a linked issue.

@Wishbringer
Copy link
Contributor

Wishbringer commented Nov 21, 2022

Managed to fix the crash I was having when trying to select liquids by changing this line:

--- a/src/inventory_ui.cpp
+++ b/src/inventory_ui.cpp
@@ -1047,7 +1047,7 @@ inventory_entry &inventory_column::get_highlighted()
 std::vector<inventory_entry *> inventory_column::get_all_selected() const
 {
     const auto filter_to_selected = [&]( const inventory_entry & entry ) {
-        return is_selected( entry );
+        return is_highlighted( entry );
     };
     return get_entries( filter_to_selected );
 }
-- 

Not sure if that is the correct way to fix it, but I'll run with it for now (hopefully doesn't break the functionality of this PR?).

@andrei8l
Copy link
Contributor Author

Managed to fix the crash I was having when trying to select liquids by changing this line:

--- a/src/inventory_ui.cpp
+++ b/src/inventory_ui.cpp
@@ -1047,7 +1047,7 @@ inventory_entry &inventory_column::get_highlighted()
 std::vector<inventory_entry *> inventory_column::get_all_selected() const
 {
     const auto filter_to_selected = [&]( const inventory_entry & entry ) {
-        return is_selected( entry );
+        return is_highlighted( entry );
     };
     return get_entries( filter_to_selected );
 }
-- 

Not sure if that is the correct way to fix it, but I'll run with it for now (hopefully doesn't break the functionality of this PR?).

That basically reverts half of this PR. Please open a bug report for the issue you're having with all the relevant info (save file, crash log, config folder) as there's probably a specific combination I'm missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using "category selection mode" allows purchase of blacklisted items ("not trusted enough")
4 participants