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

Favorite ammo location for RELOAD_AND_SHOOT and RELOAD_ONE weapons. #27144

Merged
merged 3 commits into from
Dec 20, 2018

Conversation

OzoneH3
Copy link
Member

@OzoneH3 OzoneH3 commented Dec 17, 2018

Summary

SUMMARY: Features "Favorite ammo location for RELOAD_AND_SHOOT and RELOAD_ONE weapons."

Purpose of change

Fixes #26636
Fixes #15702

It's quite annoying to shoot RELOAD_AND_SHOOT and reload RELOAD_ONE weapons with multiple ammo types available, since it always queries for what type to shoot.

Describe the solution

  • Allow 'r'eloading RELOAD_AND_SHOOT weapons.
  • Ammo Selection pops up with what type to favorite.
  • Selecting the same type twice will clear the favorite.
  • Favorite ammo marked with a * in ammo selection.
  • Favorite ammo count displayed next to weapon in sidebar.
  • While a favorite ammo is selected and has charges no ammo selection will open up upon 'f'iring.
  • Select favorite ammo for RELOAD_ONE guns with 'F'

Additional context

PS: This will not work for crossbows since they don't have a "RELOAD_ONE" flag for some reason.

@OzoneH3
Copy link
Member Author

OzoneH3 commented Dec 17, 2018

@BevapDin Could you please take a look at this. Since I had to change (delete some default item_location overloads which used = delete) some things I'm not really sure about to make item_location work with optional.
Also hat to add two functions to optional to work with archive.io()

@AskaHope
Copy link

What about removing the prompts spam as well? I hate when I'm trying to reload my shotgun and the game is constantly telling me that the zombie is getting closer.

src/game.cpp Outdated Show resolved Hide resolved
src/game.cpp Outdated Show resolved Hide resolved
src/optional.h Outdated Show resolved Hide resolved
src/optional.h Outdated Show resolved Hide resolved
src/item_location.cpp Outdated Show resolved Hide resolved
@BevapDin
Copy link
Contributor

Since I had to change (delete some default item_location overloads which used = delete) some things I'm not really sure about to make item_location work with optional.

Considering that item_location already supports an "invalid" / "no item" status, I would just use that and skip the cata::optional wrapper part (your code actually shows that you always have to check two things: the optional being valid and the item_location being valid).

But I'm also unsure about putting this into the item class. Why not in the player class?

@OzoneH3
Copy link
Member Author

OzoneH3 commented Dec 17, 2018

Removed the optional wrapper. Still had to remove all those overload = delete and =defaults for item_location.
I placed it in item so the ammo selection stays persistent with the item. Not a huge deal could be moved to player if deemed better.

@AskaHope

What about removing the prompts spam as well?

Thats another issue for anotehr day, not really fitting in here maybe open a issue so it won't get lost.

@darktoes
Copy link
Contributor

This is brilliant. Can't wait for it to get put in.

@OzoneH3
Copy link
Member Author

OzoneH3 commented Dec 18, 2018

Moved ammo_location to the player class, this fixes all the problems with item_location overloads.

save ammo_location

remove optional wrapper

cleanup
Check if ammo is correct since ammo_location moved to player class to prevent weirdness when switching wielded weapon

pointer simplification

pointer simplification
@OzoneH3 OzoneH3 changed the title Favorite ammo location for RELOAD_AND_SHOOT weapons. Favorite ammo location for RELOAD_AND_SHOOT and RELOAD_ONE weapons. Dec 18, 2018
@ZhilkinSerg ZhilkinSerg self-assigned this Dec 18, 2018
@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) Ranged Ranged (firearms, bows, crossbows, throwing), balance, tactics labels Dec 18, 2018
@kevingranade kevingranade merged commit cba61e5 into CleverRaven:master Dec 20, 2018
@ZhilkinSerg ZhilkinSerg removed their assignment Dec 20, 2018
@OzoneH3 OzoneH3 deleted the ammo_location branch October 9, 2019 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Ranged Ranged (firearms, bows, crossbows, throwing), balance, tactics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants