From ed8ee6c5ee11faa0776ee7f3a51ece4229298397 Mon Sep 17 00:00:00 2001 From: KorGgenT Date: Wed, 6 May 2020 14:04:15 -0400 Subject: [PATCH 1/2] fix negative ammo in quivers --- src/item_pocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/item_pocket.cpp b/src/item_pocket.cpp index 2a303c6f4a500..e0e64b066aba9 100644 --- a/src/item_pocket.cpp +++ b/src/item_pocket.cpp @@ -903,7 +903,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 ); From b8488bde775dcdbae008168807de03cdc47d9398 Mon Sep 17 00:00:00 2001 From: KorGgenT Date: Wed, 6 May 2020 14:04:30 -0400 Subject: [PATCH 2/2] fix debug message when trying to pick up an item you can pick up --- src/pickup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pickup.cpp b/src/pickup.cpp index 36c1fdde5167f..1c25a75a1528b 100644 --- a/src/pickup.cpp +++ b/src/pickup.cpp @@ -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() ) {