Skip to content

Commit

Permalink
Display list of useable fuels in cbm item description (CleverRaven#35364
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Fris0uman authored and AMurkin committed Nov 13, 2019
1 parent 1e06e23 commit 863b07b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2875,12 +2875,27 @@ void item::final_info( std::vector<iteminfo> &info, const iteminfo_query *parts,

const bionic_id bid = type->bionic->id;

const std::vector<itype_id> &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 "<info>" + item_controller->find_template( id )->nname( 1 ) + "</info>"; } ) ) );
}

insert_separation_line( info );

if( bid->capacity > 0_mJ ) {
info.push_back( iteminfo( "CBM", _( "<bold>Power Capacity:</bold>" ), " <num> mJ",
iteminfo::no_newline,
units::to_millijoule( bid->capacity ) ) );
}

insert_separation_line( info );

if( !bid->encumbrance.empty() ) {
info.push_back( iteminfo( "DESCRIPTION", _( "<bold>Encumbrance:</bold> " ),
iteminfo::no_newline ) );
Expand Down

0 comments on commit 863b07b

Please sign in to comment.