From 863b07b6ca5b95cbbb512598a2bcdde211d2e223 Mon Sep 17 00:00:00 2001 From: Fris0uman <41293484+Fris0uman@users.noreply.github.com> Date: Thu, 7 Nov 2019 21:46:27 +0100 Subject: [PATCH] Display list of useable fuels in cbm item description (#35364) --- src/item.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/item.cpp b/src/item.cpp index adf2ceb8a4f2f..f023fa6c4dd54 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -2875,12 +2875,27 @@ void item::final_info( std::vector &info, const iteminfo_query *parts, const bionic_id bid = type->bionic->id; + const std::vector &fuels = bid->fuel_opts; + if( !fuels.empty() ) { + const int &fuel_numb = fuels.size(); + + info.push_back( iteminfo( "DESCRIPTION", + ngettext( "* This bionic can produce power from the following fuel: ", + "* This bionic can produce power from the following fuels: ", + fuel_numb ) + enumerate_as_string( fuels.begin(), + fuels.end(), []( const itype_id & id ) -> std::string { return "" + item_controller->find_template( id )->nname( 1 ) + ""; } ) ) ); + } + + insert_separation_line( info ); + if( bid->capacity > 0_mJ ) { info.push_back( iteminfo( "CBM", _( "Power Capacity:" ), " mJ", iteminfo::no_newline, units::to_millijoule( bid->capacity ) ) ); } + insert_separation_line( info ); + if( !bid->encumbrance.empty() ) { info.push_back( iteminfo( "DESCRIPTION", _( "Encumbrance: " ), iteminfo::no_newline ) );