From 46dbddbfeba2c558bfc4e544ca561da9093aab31 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Mon, 5 Oct 2020 21:03:23 -0400 Subject: [PATCH] Display contained items like "water (plastic bottle)" instead of "plastic bottle of water". --- src/item.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/item.cpp b/src/item.cpp index 5a33ae1fe96c2..70955aeaa5982 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -4207,16 +4207,13 @@ std::string item::tname( unsigned int quantity, bool with_prefix, unsigned int t maintext += string_format( " (%d%%)", percent_progress ); } else if( contents.num_item_stacks() == 1 ) { const item &contents_item = contents.front(); - if( contents_item.made_of( LIQUID ) || contents_item.is_food() ) { - const unsigned contents_count = contents_item.charges > 1 ? contents_item.charges : quantity; - //~ %1$s: item name, %2$s: content liquid, food, or drink name - maintext = string_format( pgettext( "item name", "%1$s of %2$s" ), label( quantity ), - contents_item.tname( contents_count, with_prefix ) ); - } else { - //~ %1$s: item name, %2$s: non-liquid, non-food, non-drink content item name - maintext = string_format( pgettext( "item name", "%1$s with %2$s" ), label( quantity ), - contents_item.tname( quantity, with_prefix ) ); - } + const unsigned contents_count = + ( ( contents_item.made_of( LIQUID ) || contents_item.is_food() ) && + contents_item.charges > 1 ) + ? contents_item.charges + : quantity; + maintext = string_format( pgettext( "item name", "%2$s (%1$s)" ), label( quantity ), + contents_item.tname( contents_count, with_prefix ) ); } else if( !contents.empty() ) { maintext = string_format( npgettext( "item name", //~ %1$s: item name, %2$zd: content size