Make unloading items not pick them up #40541
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Interface "Make unloading items not pick them up"
Purpose of change
Fixes #40000
Describe the solution
Make player::unload take a item_location& instead of an item&. It used to assume that the item was in the in the player's inventory, constructing a item_location using *this. #37023 was a workaround for this, picking up any item before unloading it. I kept the check for deleting an item with MAG_DESTROY that is not a magazine, but moved it from avatar_action::unload into player::unload.
Describe alternatives you've considered
Maybe move the deleting of empty belts to outside of player::unload?
Testing
Placed ammo belts and regular items on the floor, and unloaded them. Also added MAG_DESTROY flag to talking doll and unloaded it from the floor, as magazines are handled differently than other things with ammo.