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

Fix use menu denial message and invoking items for comestibles without charges #67342

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

mqrause
Copy link
Contributor

@mqrause mqrause commented Jul 31, 2023

Summary

None

Purpose of change

Fixes #67330

Describe the solution

Exit early when checking item::ammo_sufficient for comestibles, so the menu and invoking items accepts comestibles as having the required charge.

Describe alternatives you've considered

This whole chain of item::ammo_sufficient > item::shots_remaining > item::ammo_required > item::ammo_remaining is really ugly, because it shouldn't even have anything to do with comestibles. But it's still checking them, expects comestibles to use 1 charge, but now obviously fails for uncharged comestibles. This really should get a rework to properly split things up, but that requires quite a bit more work.

Testing

Activated a caffein pill from the use menu.

Additional context

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jul 31, 2023
@mqrause
Copy link
Contributor Author

mqrause commented Aug 1, 2023

Looks like this won't work, unfortunately.

Actually similar enough solution to justify reopening this.

@mqrause mqrause closed this Aug 1, 2023
@mqrause mqrause deleted the use_menu_fix branch August 1, 2023 08:57
@mqrause mqrause restored the use_menu_fix branch August 1, 2023 10:31
@mqrause mqrause reopened this Aug 1, 2023
@mqrause mqrause changed the title Fix use menu denial message for comestibles without charges Fix use menu denial message and invoking items for comestibles without charges Aug 1, 2023
@Hirmuolio
Copy link
Contributor

Hirmuolio commented Aug 1, 2023

I feel like adding extra checks for this in ammo_sufficient is not good. I think it would be better to have that check somewhere around here

!it.ammo_sufficient( &you, uses.begin()->first ) ) {

@mqrause
Copy link
Contributor Author

mqrause commented Aug 1, 2023

I don't like the whole setup either, but it's what ammo_sufficient actually checks and it does so at multiple places. Before the charge removal, it'd go deeper into the chain and check if charges is larger than qty. Which is always true for comestibles if I'm not mistaken because qty will always be 1 and charges will always be >= 1 if the item actually exists.

It'd be great to clean this all up, but I'm currently not willing to dive into that. Most important is making the use menu functional with comestibles and actually allow comestibles with use actions to be actually used.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Aug 1, 2023
@Rivet-the-Zombie Rivet-the-Zombie merged commit e2d97b1 into CleverRaven:master Aug 2, 2023
@mqrause mqrause deleted the use_menu_fix branch August 2, 2023 11:31
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 <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cattle fodder(and pills ) need charge in use menu
3 participants