Skip to content

Commit

Permalink
Fix negative ammo in quivers (#40259)
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT authored May 6, 2020
1 parent 646e397 commit 8513b65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/item_pocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ void item_pocket::overflow( const tripoint &pos )
for( auto iter = contents.begin(); iter != contents.end(); ) {
item &ammo = *iter;
total_qty += ammo.count();
const int overflow_count = ammo_iter->second - ammo.count() - total_qty;
const int overflow_count = total_qty - ammo_iter->second;
if( overflow_count > 0 ) {
ammo.charges -= overflow_count;
item dropped_ammo( ammo.typeId(), ammo.birthday(), overflow_count );
Expand Down
4 changes: 2 additions & 2 deletions src/pickup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ bool pick_one_up( item_location &loc, int quantity, bool &got_water, bool &offer

bool did_prompt = false;
if( newit.count_by_charges() ) {
newit.charges = u.i_add_to_container( newit, false );
newit.charges -= u.i_add( newit ).charges;
}
if( newit.is_ammo() && newit.charges == 0 ) {
if( newit.is_ammo() && newit.charges <= 0 ) {
picked_up = true;
option = NUM_ANSWERS; //Skip the options part
} else if( newit.is_frozen_liquid() ) {
Expand Down

0 comments on commit 8513b65

Please sign in to comment.