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 consumption of mixed ammo in magazines #2004

Merged

Conversation

olanti-p
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Fix consumption of mixed ammo in magazines"

Purpose of change

When reloading a magazine with a mix of favorite and non-favorite ammo the 2 types stay as separate stacks inside the magazine.
But the gun code isn't "quite there" when it comes to handling mixed ammo, so the part where they're consumed mistakenly uses back() instead of front() to refer to the stack to remove, which ends up with wrong stack of ammo being erased.

Example repro steps:

  1. Debug spawn Glock 31
  2. Unload the glock
  3. Drop 14 ammo
  4. Mark the remaining as favorite
  5. Pick up dropped ammo
  6. Load glock with 1 piece of favorite ammo
  7. Load glock with 14 pieces of non-favorite ammo
  8. Shoot once
  9. See 14 ammo being consumed

Describe the solution

Fix back() -> front()

Testing

Repeated repro steps, bug is fixed

@Coolthulhu Coolthulhu self-assigned this Oct 15, 2022
@Coolthulhu Coolthulhu merged commit be865de into cataclysmbnteam:upload Oct 19, 2022
@olanti-p olanti-p deleted the fix-mixed-ammo-consumption branch October 20, 2022 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants