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

Change order of events in player::fire_gun #14525

Merged
merged 1 commit into from Dec 20, 2015

Conversation

Projects
None yet
2 participants
@mugling
Copy link
Contributor

commented Dec 20, 2015

The order of events in player::fire_gun is significant. When the last unit of ammunition is consumed item::ammo_consume() should unset curammo.

The order of events is updated to:

  1. Select target
  2. Chance to misfire (player::handle_gun_damage)
  3. Update recoil
  4. Take shot (projectile_attack)
  5. Play sound effects
  6. Use up ammo (item::ammo_consume)
  7. Drain UPS (should be a function)
  8. Train (player::practice)

This is the minimal required changes to hopefully fix #14524.

Change order of events in player::fire_gun
If the gun is emptied ammo_consume() will unset curammo.
Consume ammo at the end of the loop to prevent null pointer deference

@kevingranade kevingranade merged commit 42ab7b9 into CleverRaven:master Dec 20, 2015

1 check passed

default
Details

@mugling mugling deleted the mugling:fix_pj2 branch Jan 31, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.