Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bionic menu clean up #35221

Merged
merged 3 commits into from
Nov 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/bionics_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,24 @@ static void draw_bionics_titlebar( const catacurses::window &window, player *p,
bionic_menu_mode mode )
{
werase( window );
std::ostringstream fuel_stream;
fuel_stream << _( "Available Fuel: " );
std::string fuel_string;
bool found_fuel = false;
fuel_string = _( "Available Fuel: " );
for( const bionic &bio : *p->my_bionics ) {
for( const itype_id fuel : p->get_fuel_available( bio.id ) ) {
const item temp_fuel( fuel );
found_fuel = true;
const item temp_fuel( fuel ) ;
if( temp_fuel.has_flag( "PERPETUAL" ) ) {
fuel_string += colorize( temp_fuel.tname(), c_green ) + " ";
continue;
}
fuel_stream << temp_fuel.tname() << ": " << "<color_green>" << p->get_value(
fuel ) << "</color>" << "/" << p->get_total_fuel_capacity( fuel ) << " ";
fuel_string += temp_fuel.tname() + ": " + colorize( p->get_value( fuel ),
c_green ) + "/" + std::to_string( p->get_total_fuel_capacity( fuel ) ) + " ";
}
}
if( !found_fuel ) {
fuel_string.clear();
}
std::string power_string;
const int curr_power = units::to_millijoule( p->get_power_level() );
const int kilo = curr_power / units::to_millijoule( 1_kJ );
Expand Down Expand Up @@ -98,14 +104,15 @@ static void draw_bionics_titlebar( const catacurses::window &window, player *p,
std::string desc;
if( mode == REASSIGNING ) {
desc = _( "Reassigning.\nSelect a bionic to reassign or press SPACE to cancel." );
fuel_string.clear();
} else if( mode == ACTIVATING ) {
desc = _( "<color_green>Activating</color> <color_yellow>!</color> to examine, <color_yellow>=</color> to reassign, <color_yellow>TAB</color> to switch tabs, <color_yellow>s</color> to toggle fuel saving mode." );
} else if( mode == EXAMINING ) {
desc = _( "<color_light_blue>Examining</color> <color_yellow>!</color> to activate, <color_yellow>=</color> to reassign, <color_yellow>TAB</color> to switch tabs, <color_yellow>s</color> to toggle fuel saving mode." );
}
int n_pt_y = 0;
fold_and_print( window, point( 1, n_pt_y++ ), pwr_str_pos, c_white, desc );
fold_and_print( window, point( 1, n_pt_y++ ), pwr_str_pos, c_white, fuel_stream.str() );
fold_and_print( window, point( 1, n_pt_y++ ), pwr_str_pos, c_white, fuel_string );
wrefresh( window );
}

Expand Down