From 4a1b2c2f6d2361f71bc493cf7fc259c26d5a4910 Mon Sep 17 00:00:00 2001 From: KorGgenT Date: Wed, 6 May 2020 14:04:15 -0400 Subject: [PATCH] fix negative ammo in quivers --- src/item_pocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/item_pocket.cpp b/src/item_pocket.cpp index 2a303c6f4a500..50d5bbe4dbb37 100644 --- a/src/item_pocket.cpp +++ b/src/item_pocket.cpp @@ -903,8 +903,8 @@ 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; - if( overflow_count > 0 ) { + const int overflow_count = ammo.count() - total_qty; + if( overflow_count > ammo_iter->second ) { ammo.charges -= overflow_count; item dropped_ammo( ammo.typeId(), ammo.birthday(), overflow_count ); g->m.add_item_or_charges( pos, contents.front() );