From 443c97285118aa34801b898ee1c44b0f208a326a Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:50:13 +0100 Subject: [PATCH] Remember charges.first and charges.second can be individually set --- src/item_group.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/item_group.cpp b/src/item_group.cpp index fa93f0749d812..f67b632ae1f2b 100644 --- a/src/item_group.cpp +++ b/src/item_group.cpp @@ -494,9 +494,10 @@ std::map> Single_item_creator::every_item_min case S_ITEM: { auto i = item::find_type( itype_id( id ) ); if( i->count_by_charges() ) { + // TODO: Not technically perfect for only charge_min/charge max and for ammo/liquids but Item_modifier::modify()'s logic is gross and I'd rather not try to replicate it perfectly as is const int min_charges = modifier->charges.first == -1 ? i->charges_default() : modifier->charges.first; - const int max_charges = modifier->charges.first == -1 ? + const int max_charges = modifier->charges.second == -1 ? i->charges_default() : modifier->charges.second; return { std::make_pair( i, std::make_pair( modifier->count.first * min_charges, modifier->count.second * max_charges ) ) }; }